Hey guys,
Please can you tell me what
The error pops up: MessageBox.Show("Error creating Landlord - Please contact Support")Code:Dim con As New SqlConnection Dim cmd As New SqlCommand Try con.ConnectionString = ("Data Source=ANDY-PC\LETTINGS;Initial Catalog=easylet_database;User Id=sa;Password=g3m1n1;") con.Open() cmd.Connection = con cmd.CommandText = "INSERT INTO Landlord (Title,FirstName,LastName,Email,Telephone,Telephone2,Fax,Source,Address1,Address2,Address3,Address4,PostCode,Occupation,Bank_Number,Bank_Sortcode,Bank_AccountName,Bank_Company,Notes,Inactive,Date) VALUES (" & Title.Text & "," & FirstName.Text & "," & Surname.Text & "," & Email.Text & "," & Phone1.Text & "," & Phone2.Text & "," & Fax.Text & "," & Source.Text & "," & Ad1.Text & "," & Ad2.Text & "," & Ad3.Text & "," & Ad4.Text & "," & Postcode.Text & "," & Occupation.Text & "," & AccNo.Text & "," & SortCode.Text & "," & AccName.Text & "," & AccCompany.Text & "," & Notes.Text & ")" cmd.ExecuteNonQuery() Catch ex As Exception MessageBox.Show("Error creating Landlord - Please contact Support") Finally con.Close() End Try
I think I have done the sql command syntax wrong.
Cheers.




Reply With Quote