Hi
I'm using a simple insert statemnt in from two textfield into my database
using this code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If (TextBox1.Text.Trim = "") Then
MessageBox.Show("PLEASE DO NOT USE BLANK SPACES", "Data Entry Error")
ElseIf (TextBox2.Text.Trim = "") Then
MessageBox.Show("PLEASE DO NOT USE BLANK SPACES", "Data Entry Error")
Else 'if user has not entered a blank space
'Server=.\SQLExpress;AttachDbFilename=|DataDirectory|MyDataFile.mdf;Database=dbname;Trusted_Connection = Yes(Example)
'Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Users\Paras\documents\visual studio 2010\Projects\ESI_PF_Payroll_V1\ESI_PF_Payroll_V1\Payroll.mdf";Integrated Security=True;Connect Timeout=30;User Instance=True
con.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Anuj Rishi\documents\visual studio 2010\Projects\ESI_PF_Payroll_V1\ESI_PF_Payroll_V1\Payroll.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
con.Open()
cmd.Connection = con
cmd.CommandText = "INSERT INTO tbllogin (username,password) VALUES ('" & TextBox1.Text & "','" & TextBox2.Text & "')"
cmd.ExecuteNonQuery()
MessageBox.Show(cmd.CommandText.ToString())
adapter = New SqlDataAdapter
adapter.InsertCommand = cmd
adapter.Update(data)
'adapter.TableMappings.Add("tbllogin", adapter.ToString())
con.Close()
MessageBox.Show("Data Inserted")
Login.Show()
End If
End sub
getting this error
Update unable to find TableMapping['Table'] or DataTable 'Table'.