Private Sub CheckData()
Dim cmd As New SqlCommand
Dim da As New SqlDataAdapter
Dim ds As New DataSet
Dim dt As New DataTable
' Dim temp As String
Try
With cmd
.Connection = mycon
.CommandType = CommandType.Text
'.CommandText = "select top 1 * from employee order by newid()"
' .CommandText = "select itc_id from itc"
.CommandText = "select Max(ID) from Tape"
End With
da.SelectCommand = cmd
da.Fill(ds, "Show") 'Keep data to Dataset
[font=Verdana]txtMAX.Text = dt.Rows(0).ToString() 'ทำอย่างไรต่อครับ บรรทัดนี้[/font]
' DataGrid1.DataSource = ds.Tables("Show") ' โชว์ใน Datagrid โชว์ได้ครับ
Catch exsql As SqlException
MsgBox(exsql.Message, MsgBoxStyle.Exclamation)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation)
End Try
End Sub