NCHU逸尘
2016-01-10 11:02
采纳率: 64.3%
浏览 1.6k

如何VB实现sql server表里添加数据?

Public Class 图书信息添加
Dim str1 As String
Dim str2 As String
Dim str3 As String
Dim str4 As String
Dim a As Integer
Dim b As Integer

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

就差这里的代码了啊!跪求大神啊!
我用数据源添加的 ,好像不用代码也能链接,可是怎么才能执行SQL语句啊

    MsgBox("添加成功!")
    Me.Hide()
    主窗口.Show()

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    Me.Hide()
    主窗口.Show()

End Sub

Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
    '图书编号
    str1 = TextBox1.Text

End Sub

Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
    '作者
    str3 = TextBox3.Text
End Sub

Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
    '书名
    str2 = TextBox2.Text
End Sub

Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs) Handles TextBox4.TextChanged
    '价格
    b = TextBox4.Text
End Sub

Private Sub TextBox5_TextChanged(sender As Object, e As EventArgs) Handles TextBox5.TextChanged
    '时间上限
    a = TextBox5.Text
End Sub

Private Sub TextBox6_TextChanged(sender As Object, e As EventArgs) Handles TextBox6.TextChanged
    '类别
    str4 = TextBox6.Text
End Sub

Private Sub 图书信息添加_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub

End Class图片说明

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题