tableadapter.insert的问题

时间:2013-10-07 01:53:33

标签: vb.net-2010

我是编程新手,并尝试通过youtube教程学习VB.net。所以我试图为“登录”和“创建新帐户”创建单独的表单。登录似乎工作正常。但是,创建帐户对我来说很难成功编写代码。我遇到的主要问题是“插入”代码。我创建了一个“createnewaccount”表单并将数据库连接到它。然后我在“btnsave”下编写代码,这样当人们创建新帐户时,它将被保存到数据库中。这是我不断遇到问题的地方。它说“UsersPasswordsTableAdapter1.Insert”,它一直强调它,程序不起作用。这是我的代码。任何帮助都会有所帮助。

进口系统 导入System.Data Imports System.Data.OleDb 公共类CreateNewAccount

Private Sub CreateNewAccount_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Me.UsersPasswordsTableAdapter1.Fill(Me.UsersPasswordsDataSet1.UsersPasswords)

End Sub

Private Sub btnSaveNewAccount_Click(sender As Object, e As EventArgs) Handles btnSaveNewAccount.Click
    LoginPage.UsersPasswordsTableAdapter1.Insert(Me.TextBox1.Text, Me.TextBox2.Text, Me.TextBox3.Text)
    LoginPage.UsersPasswordsTableAdapter1.Fill(LoginPage.UsersPasswordsDataSet1.UsersPasswords)
    MsgBox("Your Account has been saved successfully", MsgBoxStyle.Information)
    TextBox1.Text = ""
    TextBox2.Text = ""
    TextBox3.Text = ""

End Sub

Private Sub btnBacktoLogin_Click(sender As Object, e As EventArgs) Handles btnBacktoLogin.Click
    Me.Hide()
    LoginPage.Show()

End Sub

结束班

0 个答案:

没有答案