为什么我会遇到这种错误。我一直在练习教程,但我仍然得到这个。应该如何清除这个错误。我已经开始练习.net了。所以请指导我
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim std As DataSet1TableAdapters.studentTableAdapter
If txtname.Text = "" Then
lblMessage.Text = "Please enter name"
ElseIf txtclass.Text = "" Then
lblMessage.Text = "Please enter class "
ElseIf txtsemseter.Text = "" Then
lblMessage.Text = "Please enter semester"
Else
std.Insert(Name:=txtname.Text, Class:=txtclass.Text, Semester:=txtsemseter.Text)
End If
End Sub
答案 0 :(得分:2)
执行以下操作
Dim std As New DataSet1TableAdapters.studentTableAdapter()
当您致电std.Insert
时,您需要拥有DataSet1TableAdapters.studentTableAdapter
答案 1 :(得分:0)
您需要新建变量,如:
Dim std As New DataSet1TableAdapters.studentTableAdapter()
编辑:我试图在手机上这样做,不容易:)