Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > BOOK: Beginning VB.NET Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning VB.NET Databases
This is the forum to discuss the Wrox book Beginning VB.NET Databases by Thearon Willis; ISBN: 9780764568008
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning VB.NET Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 2nd, 2007, 06:16 AM
Authorized User
 
Join Date: Jan 2006
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Insert Query not workng because of Replication?

Hi guys,

I wonder if you could help?

I've just replicated my database into master and replica databases. Now I'm retesting my vb.net application (it uses some of the framework of Beginning VB.NET Databases).

I'm running some code that uses an 'insert' query and now I get the following error message:

Number of query values and destination fields are not the same

Here's the query code:

objData.SQL = "INSERT INTO [FitnessTestHistory] " & _
   "VALUES(@ID, @DATEOFTEST, @VESSELID)"

objData.InitializeCommand()

objData.AddParameter("@ID", OleDb.OleDbType.Guid, 16, guidCrewMemberID)
objData.AddParameter("@DATEOFTEST", OleDb.OleDbType.DBDate, 8, DateTime.Parse(txtDateOfTest.Text))
objData.AddParameter("@VESSELID", OleDb.OleDbType.VarChar, 5, txtVessel.Text)

objData.OpenConnection()

intRowsAffected = objData.Command.ExecuteNonQuery()


MS Access automatically added the following fields to each table when I did the reputation:

s_ColLineage
s_Generation
s_GUID
s_Lineage

Are these the problem? Can anyone tell me what is going on? Thanks in advance.

Reply With Quote
  #2 (permalink)  
Old September 3rd, 2007, 05:45 AM
Authorized User
 
Join Date: Jan 2006
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I've managed to sort out a work around answer folks.

Instead of hard coding the "INSERT INTO [tablename] part of the SQL statement, in my Access table, I created parameter query and then called the parameter query from the SQL object.

This seems to work.

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Into Query. rupen Access VBA 5 July 30th, 2007 09:58 AM
Where does insert query go? bph Access VBA 5 June 12th, 2007 12:26 PM
INSERT Query Neal SQL Server 2000 2 May 3rd, 2007 05:18 PM
I solved insert query.now see this Update Query. amit_mande@yahoo.com VB.NET 2002/2003 Basics 2 September 21st, 2006 12:48 AM
INSERT INTO QUERY sanjna000 Excel VBA 5 November 25th, 2004 11:41 PM



All times are GMT -4. The time now is 02:35 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.