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 Chris Miller 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.

EscapeUK

Programmer
Jul 7, 2000
438
GB
I want to link to a SQL DB then run a stored procdure.

Could someone give me some common code.

I am new to this

 
The following should help.

If you not sure of the connection string, choose Data Environment in VB and then add a connection then select SQL Simple Provider and then choose your DB then click properties of the connection and copy the connection string.

conn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Employee;Data Source=TECHNO10"

conn.BeginTrans
FirstName = "Delton"
LastName =Phill"
Department = "Technology"
NewExtNo = "6342"
Comments = "Delton is employed to the company as a programmer"

With comm
Set .ActiveConnection = conn
.CommandType = adCmdStoredProc
.CommandText = "INSERTINFO"
.Parameters.Refresh
.Parameters("@chFirstName").Value = FirstName
.Parameters("@chFirstName").Direction = adParamInput
.Parameters("@chLastName").Value = LastName
.Parameters("@chLastName").Direction = adParamInput
.Parameters("@chDepartment").Value = Department
.Parameters("@chDepartment").Direction = adParamInput
.Parameters("@chNewExtNo").Value = NewExtNo
.Parameters("@chNewExtNo").Direction = adParamInput
.Parameters("@chComments").Value = Comments
.Parameters("@chComments").Direction = adParamInput
.Execute
End With

conn.CommitTrans
conn.Close

Delton Phillips.
deltonphillips@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top