Accessing a Sybase Stored Procedure
-
I'm having some problems here. What I want to do is access a sybase stored procedure through a c++ program. The problem I'm having is, 1) adding a data source to an already existing program. (I'm using Microsoft Visual Studio). 2) how to call the stored procedure and how to acess the results. If anyone can give me any help it would be most appreciated. ICXC NIKA
-
I'm having some problems here. What I want to do is access a sybase stored procedure through a c++ program. The problem I'm having is, 1) adding a data source to an already existing program. (I'm using Microsoft Visual Studio). 2) how to call the stored procedure and how to acess the results. If anyone can give me any help it would be most appreciated. ICXC NIKA
http://www.codeproject.com/database/readdb.asp[^] Update ur driver in the code to the sybase driver installed ( u can check it in the ODBC in control panel) and use SQL like EXEC storedProcedure ( or call , i dont recall exactly:)) eg. exec sp_FileExist 'F', 'CLNHLDY_DBF' Hope this helps Papa while (TRUE) Papa.WillLove ( Bebe ) ;
-
I'm having some problems here. What I want to do is access a sybase stored procedure through a c++ program. The problem I'm having is, 1) adding a data source to an already existing program. (I'm using Microsoft Visual Studio). 2) how to call the stored procedure and how to acess the results. If anyone can give me any help it would be most appreciated. ICXC NIKA
You need to either use the Sybase CTlib directly or use a higher level abstraction layer, such as ODBC or ADO. If using ODBC, you need the Sybase ODBC driver installed on the system and configured correctly. Once that is done, you can use SQLExecDirect or SQLPrepare/SQLExecute to invoke the SP. Remember that you either need to change to the appropriate database (using a CTLib function or SQL USE {database} query -OR- embed the database name in the procedure) sprintf(caSQLBuf,"exec %s.dbo.MyProcedure '%s'", caDBName, caParam1); SQLExecDirect(caSQLBuf). Let me know if you need a generic ODBC class library or if you don't want to roll your own.