Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedure

Status
Not open for further replies.

VBXL

Programmer
Jul 10, 2001
198
GB
How do you run a stored procedure from VB6 to insert a table with a primary key

i.e.
Set Param = cmd.CreateParameter("@primarykey", adVarChar, adParamInput, 200, a)
cmd.Parameters.Append Param

Set Param = cmd.CreateParameter("@create_dttm_3", adDate, adParamInput, , b)
cmd.Parameters.Append Param

I cannot insert it, what am i doing wrong ?
Cheers

GazC
 
I am not to sure what your question means. When you sat insert a primary key, are you just adding a record? Also in your code above, if when you say, 'I cant insert it" Do you mean the parameter or the record. If it is the record, you are not executing the procedure in your code above.
 
Yes i am adding a record i.e.

Table1

PrimaryKey Numeric 9
examplea Varchar 10

I have set up a stored procedure on SQL Server.
I wish to enter variable in a text box (examplea) in VB and I want it to insert it into a table on SQL Server.

GazC
 
Again, if the entire code you posted is what you are using, you are not executing the sp. If you are only entering 1 record at a time with only two fields, why not use a SQL update statment? I do not see the performance advantage with a sp in this case.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top