使用此代码,我得到一个错误,指出"SelectCommand"不是StudentsTableAdapter的成员。
Dim cmd As New SqlCommand("SELECT * FROM Students WHERE ID=@ID", myConnection)
cmd.Parameters.AddWithValue("@ID", 5)
Me.StudentsTableAdapter.SelectCommand = cmd
Me.StudentsTableAdapter.Fill(Me.StudentsDataSet.Students)
连接对象是这样的:
Dim ObjConnection As New SqlConnection(My.Settings.SelimiyeMasjidConnectionString)
你能告诉我如何使SelectCommand成为表适配器的成员吗?
将表适配器的属性"GenerateDirectDBMethods"更改为True。更新、删除等命令现在将自动生成。