S
sparkle
Hi everyone,
I have successfully used this same command in msAccess using an
oledbCommand, but can't get it to work in sqlServer 2000.
I have simplified everything down to one column to fill just to see
where I am going wrong.
Here is my code for loading the form:
dbCONN.Open()
With daPermits
SQLStr = "SELECT * FROM Permits"
cmd = New System.Data.SqlClient.SqlCommand(SQLStr, dbCONN)
cmd.CommandType = CommandType.Text
.SelectCommand = cmd
.Fill(dsPermits)
.Dispose()
End With
dsPermits.AcceptChanges()
PermitsTable = dsPermits.Tables.Item(0)
dsPermits.Dispose()
dbCONN.Close()
'''''then I have the user click an add button, which clears the form,
then the user types a permitnumber into a textbox and clicks SAVE.
Here is the code for the SAVE:
Sub UpdateDB()
cmdInsertPermits.Parameters("@param1").Value =
txtPermitNumber.Text
dbCONN.Open()
Try
cmdInsertPermits.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.ToString)
Clipboard.SetDataObject(ex.ToString, True)
End Try
dbCONN.Close()
DsPermits.Clear()
LoadForm()
End Sub
Here is the code for the cmdInsertPermits:
INSERT INTO Permits (PermitNumber) VALUES (?)
What gives? I can see that the data is noticed in the autos window, so
why do I get the incorrect syntaz near '?'
Also, it works when I configure the cmdInsertPermits control...
Thanks for any help
I have successfully used this same command in msAccess using an
oledbCommand, but can't get it to work in sqlServer 2000.
I have simplified everything down to one column to fill just to see
where I am going wrong.
Here is my code for loading the form:
dbCONN.Open()
With daPermits
SQLStr = "SELECT * FROM Permits"
cmd = New System.Data.SqlClient.SqlCommand(SQLStr, dbCONN)
cmd.CommandType = CommandType.Text
.SelectCommand = cmd
.Fill(dsPermits)
.Dispose()
End With
dsPermits.AcceptChanges()
PermitsTable = dsPermits.Tables.Item(0)
dsPermits.Dispose()
dbCONN.Close()
'''''then I have the user click an add button, which clears the form,
then the user types a permitnumber into a textbox and clicks SAVE.
Here is the code for the SAVE:
Sub UpdateDB()
cmdInsertPermits.Parameters("@param1").Value =
txtPermitNumber.Text
dbCONN.Open()
Try
cmdInsertPermits.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.ToString)
Clipboard.SetDataObject(ex.ToString, True)
End Try
dbCONN.Close()
DsPermits.Clear()
LoadForm()
End Sub
Here is the code for the cmdInsertPermits:
INSERT INTO Permits (PermitNumber) VALUES (?)
What gives? I can see that the data is noticed in the autos window, so
why do I get the incorrect syntaz near '?'
Also, it works when I configure the cmdInsertPermits control...
Thanks for any help