Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Urjent help needed

Author  Topic 

vishu.av
Starting Member

26 Posts

Posted - 2007-04-27 : 11:33:19
Hi All,
I have a TABLE and a SP as below..

CREATE TABLE NAMES ( NAMES VARCHAR(12))
CREATE PROCEDURE SP_NUM @NAME VARCHAR(12)
AS
INSERT INTO NAMES VALUES(@NAME)

HOW CAN I INSERT A NAME IN MY NAMES TABLE USING ODBC CALL..
CAN I USE SOMETHING LIKE THIS


SQLCHAR name[12] = "VFLOOR";
SQLINTEGER Num2 = 0;

retcode = SQLPrepare((hStmt),(SQLCHAR*)"{CALL SP_NUM(?)}",SQL_NTS);

retcode = SQLBindParameter(hStmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR,sizeof(name) , 0,
name, 0, &Num2);
retcode = SQLExecute (hStmt);

Inspite of the fact that all is fine till last statement, the value
string in 'name' is not inserted in Name table.
Can anybody tell me what is wrong in this piece of code?
Thanks in advance







vishu
Bangalore

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-27 : 14:50:58
Also see last two posts in this topic
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=82704


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -