473,385 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Adding entry to an SQL DB via ODBC

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
3 1595
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
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
> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Jerry Weinstein | last post by:
Hi, I know about stored procedures and that they can speed up data entry via the SQL 'insert ' statement. However, one drawback to this method is that using the stored procedure still requires...
0
by: Lewt | last post by:
I am aware of the 'hack the registry' approach. This is just not a safe way to accomplish this on a user's PC. I need to do this the right way. Is there anyone -perhaps from Microsoft - out there...
2
by: silversurfer | last post by:
Hello, I am a little unsure whether this method really makes sense. The goal is to add an element to a vector. This is the struct and method I am using: std::vector<Entry> models; struct...
3
by: LFM | last post by:
I am sure there is a simple answer. I have a database that where I am trying to setup a security login based on employee number. Employee number is a 5 character numeric field. The databse...
12
by: JMO | last post by:
I can import a csv file with no problem. I can also add columns to the datagrid upon import. I want to be able to start importing at the 3rd row. This will pick up the headers necessary for the...
1
by: Chuck | last post by:
Hi, I have installed a trial version of VC++ Express 2005 with the budled SQL Server. After creating a C++ Forms prototype, with some tables into a database file named Test1.mdb, now I want to make...
3
by: Nokao | last post by:
I use db2 9 express-c Hi... I'm having that problem... .....every less-than-10-seconds, a entry like that (I displayed that entry with the command db2evmon -db 'MYDATABASE' -evm...
2
by: Steve | last post by:
I have zero experience with ODBC. If I have an Access frontend connected to a SQL Database using ODBC, are the tables connected like a frontend/backend Access database where the the tables you see...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.