Hey guys,
My first post here, so ill do my best to be clear and brief.
I am trying to pass a SQL command in .NET to execute a stored procedure in SQL. I already have my DB connection created in the GUI along with my data adapter and dataset.
I know this has to be something small I am missing so maybe another pair of eyes can see it.
Data Adapter = dbAdapter
connDB = DB connection
dsDataSet = data set
frmAdd is the name of the new form to pull the data from to pass to the stored procedure.
I think I am somehow missing some way to execute the command, but I cant seem to find a particular one for dataAdapter (already tried all the options in Help). I can't figure out how to get the command passed into SQL...
Ok here's the code:
PrivateSub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim addForm AsNew frmAdd
Dim vbTitle AsString
Dim vbLength AsInteger
Dim vbRentalRate AsDecimal
Dim vbCost AsDecimal
Dim vbPurchaseDate AsString
Dim vbRating AsString
Dim vbFormat AsString
Dim saveCommand As SqlCommand
addForm.ShowDialog()
vbTitle = addForm.txtTitle.Text
vbLength = Val(addForm.txtLength.Text)
vbRentalRate = Val(addForm.txtRentalRate.Text)
vbCost = Val(addForm.txtCost.Text)
vbPurchaseDate = addForm.txtPurchaseDate.Text
vbRating = addForm.txtRating.Text
vbFormat = addForm.txtFormat.Text
saveCommand = New SqlCommand("EXEC addRecord vbTitle, vbLength, vbRentalRate, vbCost, vbPurchaseDate, vbRating, vbFormat", connDB)
'* Call to stored procedure in SQL, yes it works
daAdapter.Fill(dsDataSet)
EndSub
Thanks to anyone who takes a quick look!
My first post here, so ill do my best to be clear and brief.
I am trying to pass a SQL command in .NET to execute a stored procedure in SQL. I already have my DB connection created in the GUI along with my data adapter and dataset.
I know this has to be something small I am missing so maybe another pair of eyes can see it.
Data Adapter = dbAdapter
connDB = DB connection
dsDataSet = data set
frmAdd is the name of the new form to pull the data from to pass to the stored procedure.
I think I am somehow missing some way to execute the command, but I cant seem to find a particular one for dataAdapter (already tried all the options in Help). I can't figure out how to get the command passed into SQL...
Ok here's the code:
PrivateSub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim addForm AsNew frmAdd
Dim vbTitle AsString
Dim vbLength AsInteger
Dim vbRentalRate AsDecimal
Dim vbCost AsDecimal
Dim vbPurchaseDate AsString
Dim vbRating AsString
Dim vbFormat AsString
Dim saveCommand As SqlCommand
addForm.ShowDialog()
vbTitle = addForm.txtTitle.Text
vbLength = Val(addForm.txtLength.Text)
vbRentalRate = Val(addForm.txtRentalRate.Text)
vbCost = Val(addForm.txtCost.Text)
vbPurchaseDate = addForm.txtPurchaseDate.Text
vbRating = addForm.txtRating.Text
vbFormat = addForm.txtFormat.Text
saveCommand = New SqlCommand("EXEC addRecord vbTitle, vbLength, vbRentalRate, vbCost, vbPurchaseDate, vbRating, vbFormat", connDB)
'* Call to stored procedure in SQL, yes it works
daAdapter.Fill(dsDataSet)
EndSub
Thanks to anyone who takes a quick look!