dr.Close()
conn.Close()
If (numm < 10) Then
TextBox1.Text = "" & numm
Else
TextBox1.Text = "" & numm
End If
Else
conn.Close()
TextBox1.Text = ""
End If
End With
Tag : .NET, Ms SQL Server 2008
Date :
2013-02-13 00:32:14
By :
Aonaka
View :
785
Reply :
1
No. 1
Guest
ขออภัยค่ะ ก็อบโค๊ดไม่หมด อิอิ Code (VB.NET)
conn = New SqlConnection()
With conn
If .State = ConnectionState.Open Then .Close()
.ConnectionString = Database.strConn.ToString
.Open()
End With
Dim sql5 As String = "SELECT M_ID FROM member_regis"
com = New SqlCommand
With com
.CommandType = CommandType.Text
.CommandText = sql5
.Connection = conn
.Parameters.Clear()
.Parameters.Add("member_regis", SqlDbType.VarChar).Value = "2948"
dr = .ExecuteReader()
If dr.HasRows Then
dt = New DataTable
dt.Load(dr)
numm = (CInt(dt.Rows(dt.Rows.Count - 1).Item("M_ID").ToString)) + 1
dt.Clear()
dr.Close()
conn.Close()
If (numm < 10) Then
TextBox1.Text = "" & numm
Else
TextBox1.Text = "" & numm
End If
Else
conn.Close()
TextBox1.Text = ""
End If
End With