By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,219 Members | 2,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,219 IT Pros & Developers. It's quick & easy.

Adding entry to an SQL DB via ODBC

P: n/a
I am developing a front end for an SQL DB. Every other entry form I have created works, excpet the lastes one. When I try to add a new entry, on the ODBCDataapater.Update line I get the following error.

ERROR [HY007] [Microsoft][ODBC SQL Server Driver]Associated statement is not prepared
<<

I have googled the error and looked on MSDN, and I get nothing that helps. Please help ASAP. I Cannot carry on with my develpment until I sort this out.

Thanx
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
That is just the thing, I have copied the code from a working form.

But here it is.

Try
Me.intGatePassNumber = CInt(Me.editGatePassNumber.Text)
Me.dtGatePass = Me.objdsGatePass.Tables("tbl_TSGatePass")

Me.drGatePass = Me.dtGatePass.NewRow
Me.drGatePass("ID") = CInt(Me.editGatePassNumber.Text)
Me.drGatePass("PermissionTo") = Me.editPermissionTo.Text
Me.drGatePass("Company") = Me.editCompany.Text
Me.drGatePass("DateTaken") = Me.editDateTaken.Value
Me.drGatePass("DateReturning") = Me.editDateReturning.Text
Me.drGatePass("NotReturning") = Me.chkNotReturning.Checked
Me.drGatePass("AuthorisedBy") = Me.editAuthorisedBy.Text
Me.dtGatePass.Rows.Add(Me.drGatePass)

Me.odbcdaGatePassEntry.Update(Me.objdsGatePass.tbl _TSGatePass)
MsgBox("Entry added!")

Catch ex As Exception
CType(Me.MdiParent, frmMDI).dspConsoleTechnicalServices.Text = CType(Me.MdiParent, frmMDI).dspConsoleTechnicalServices.Text & vbCrLf & ex.Message
End Try

"Jonathan Allen" wrote:
It would help to see more of your code.

--
Jonathan Allen
"Vexander" wrote:
I am developing a front end for an SQL DB. Every other entry form I have created works, excpet the lastes one. When I try to add a new entry, on the ODBCDataapater.Update line I get the following error.
>

ERROR [HY007] [Microsoft][ODBC SQL Server Driver]Associated statement is not prepared
<<

I have googled the error and looked on MSDN, and I get nothing that helps. Please help ASAP. I Cannot carry on with my develpment until I sort this out.

Thanx

Nov 20 '05 #2

P: n/a
Try
Me.intGatePassNumber = CInt(Me.editGatePassNumber.Text)
Me.dtGatePass = Me.objdsGatePass.Tables("tbl_TSGatePass")

Me.drGatePass = Me.dtGatePass.NewRow
Me.drGatePass("ID") = CInt(Me.editGatePassNumber.Text)
Me.drGatePass("PermissionTo") = Me.editPermissionTo.Text
Me.drGatePass("Company") = Me.editCompany.Text
Me.drGatePass("DateTaken") = Me.editDateTaken.Value
Me.drGatePass("DateReturning") = Me.editDateReturning.Text
Me.drGatePass("NotReturning") = Me.chkNotReturning.Checked
Me.drGatePass("AuthorisedBy") = Me.editAuthorisedBy.Text
Me.dtGatePass.Rows.Add(Me.drGatePass)

Me.odbcdaGatePassEntry.Update(Me.objdsGatePass.tbl _TSGatePass)
MsgBox("Entry added!")

Catch ex As Exception
CType(Me.MdiParent, frmMDI).dspConsoleTechnicalServices.Text = CType(Me.MdiParent, frmMDI).dspConsoleTechnicalServices.Text & vbCrLf & ex.Message
End Try
"Jonathan Allen" wrote:
It would help to see more of your code.

--
Jonathan Allen
"Vexander" wrote:
I am developing a front end for an SQL DB. Every other entry form I have created works, excpet the lastes one. When I try to add a new entry, on the ODBCDataapater.Update line I get the following error.
>

ERROR [HY007] [Microsoft][ODBC SQL Server Driver]Associated statement is not prepared
<<

I have googled the error and looked on MSDN, and I get nothing that helps. Please help ASAP. I Cannot carry on with my develpment until I sort this out.

Thanx

Nov 20 '05 #3

P: n/a
> That is just the thing, I have copied the code from a working form.

Check to see that dtGatePass is being setup in exactly the same way as it was in the form you copied it from. That means looking at the all properties one by one, and the order in which they are set. I don't normally use dataTables, so I cannot tell you what to look for.

--
Jonathan Allen
"Vexander" wrote:
That is just the thing, I have copied the code from a working form.

But here it is.

Try
Me.intGatePassNumber = CInt(Me.editGatePassNumber.Text)
Me.dtGatePass = Me.objdsGatePass.Tables("tbl_TSGatePass")

Me.drGatePass = Me.dtGatePass.NewRow
Me.drGatePass("ID") = CInt(Me.editGatePassNumber.Text)
Me.drGatePass("PermissionTo") = Me.editPermissionTo.Text
Me.drGatePass("Company") = Me.editCompany.Text
Me.drGatePass("DateTaken") = Me.editDateTaken.Value
Me.drGatePass("DateReturning") = Me.editDateReturning.Text
Me.drGatePass("NotReturning") = Me.chkNotReturning.Checked
Me.drGatePass("AuthorisedBy") = Me.editAuthorisedBy.Text
Me.dtGatePass.Rows.Add(Me.drGatePass)

Me.odbcdaGatePassEntry.Update(Me.objdsGatePass.tbl _TSGatePass)
MsgBox("Entry added!")

Catch ex As Exception
CType(Me.MdiParent, frmMDI).dspConsoleTechnicalServices.Text = CType(Me.MdiParent, frmMDI).dspConsoleTechnicalServices.Text & vbCrLf & ex.Message
End Try

"Jonathan Allen" wrote:
It would help to see more of your code.

--
Jonathan Allen
"Vexander" wrote:
I am developing a front end for an SQL DB. Every other entry form I have created works, excpet the lastes one. When I try to add a new entry, on the ODBCDataapater.Update line I get the following error.
>>
ERROR [HY007] [Microsoft][ODBC SQL Server Driver]Associated statement is not prepared
<<

I have googled the error and looked on MSDN, and I get nothing that helps. Please help ASAP. I Cannot carry on with my develpment until I sort this out.

Thanx

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.