
April 25th, 2005, 02:03 AM
|
|
Registered User
|
|
Join Date: Mar 2005
Posts: 12
Time spent in forums: 2 h 36 m
Reputation Power: 0
|
|
|
Input string was not in correct format
Hi
I have some code which should just allow me to enter info into text boxes and then save it to a database. When I run it I get the following error 'Input string was not in a correct format.'
This is the command text used
Code:
INSERT INTO Places
(Name, Address1, Address2, Address3, Phone, leftx, topy, w, h)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
And this is where I am getting the problem, it highlights the area in bold.
Any ideas where I am going wrong
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OleDbDataAdapterPlaces.Fill(DataSetPlaces11)
pbman = Me.BindingContext(DataSetPlaces11, "Places")
OleDbConnection1.Open()
OleDbCommand1.CommandText = "INSERT INTO Places(Name, Address1, Address2, Address3, Phone, leftx, topy, w, h) VALUES(?,?,?,?,?,?,?,?,?)"
OleDbCommand1.Parameters.Add("@Name", TextBox1.Text)
OleDbCommand1.Parameters.Add("@Address1", TextBox2.Text)
OleDbCommand1.Parameters.Add("@Address2", TextBox3.Text)
OleDbCommand1.Parameters.Add("@Address3", TextBox4.Text)
OleDbCommand1.Parameters.Add("@Phone", TextBox5.Text)
OleDbCommand1.Parameters.Add("@leftx", TextBox6.Text)
OleDbCommand1.Parameters.Add("@topy", TextBox7.Text)
Dim DBreturn As Integer
DBreturn = OleDbCommand1.ExecuteNonQuery
OleDbConnection1.Close()
Cheers
|