Hi It is the first time for me to post a thread because I am a real beginner in VB, I use Visual Basic 2005 Express so I would really appreciate any help in this problem.
The problem is that this message shows when I click the save icon in strip tool in gridview
"The DataAdapter.SelectCommand property needs to be initialized."
and here is my code:
The problem is that this message shows when I click the save icon in strip tool in gridview
"The DataAdapter.SelectCommand property needs to be initialized."
and here is my code:
VB.NET:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'HesabatDataSet.Hesabat' table. You can move, or remove it, as needed.
Me.HesabatTableAdapter.Fill(Me.HesabatDataSet.Hesabat)
End Sub
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
Dim conn As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=""C:\Documents and Settings\Youssef El-Messiry\Local Settings\Application Data\Temporary Projects\Hesabat\Hesabat.mdf""Integrated Security=True;Connect Timeout=30;User Instance=True"
Dim da As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter
Dim sqlcb As SqlClient.SqlCommandBuilder = New SqlClient.SqlCommandBuilder(da)
da.UpdateCommand = sqlcb.GetUpdateCommand
da.InsertCommand = sqlcb.GetInsertCommand
da.DeleteCommand = sqlcb.GetDeleteCommand
sqlcb.ConflictOption = ConflictOption.CompareRowVersion
da.Update(HesabatDataSet.Hesabat)
sqlcb.RefreshSchema()
da.Update(HesabatDataSet.Hesabat)
End Sub
End Class