Tag : ASP.NET MySQL, Win (Windows App), VS 2010 (.NET 4.x), Windows
Date :
2012-08-14 19:53:41
By :
เด็กน้อยหัดเขียน
View :
1202
Reply :
3
No. 1
Guest
ลืม ครับ Code เเบบเต็มครับ
Code (VB.NET)
Public Class Form_Edit
Dim objConn As New MySqlConnection
Dim objCmd As New MySqlCommand
Dim dtAdapter As MySqlDataAdapter
Dim dt As New DataTable
Dim Connection, strSQL As String
Private Sub Form_Edit_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Connection As String
Dim Sho As New DataTable
Connection = ("Database=account ;Data Source=localhost;User Id=root;Password=root;Allow Zero Datetime=true")
objConn = New MySqlConnection(Connection)
objConn.Open()
Dim strSQL As String
strSQL = "SELECT * FROM income WHERE ID_income = '" & ID.Text & " ' "
dtAdapter = New MySqlDataAdapter(strSQL, objConn)
dtAdapter.Fill(Sho)
If Sho.Rows.Count > 0 Then
Me.ID.Text = Sho.Rows(0)("ID_income")
Me.CreateDate.Value = Sho.Rows(0)("Date")
Me.TextBoxList.Text = Sho.Rows(0)("List")
Me.TextBoxmounny.Text = Sho.Rows(0)("Money")
Me.TextBoxComment.Text = Sho.Rows(0)("Comment")
End If
Sho = Nothing
End Sub