请高手指教!在DataSet中已知某记录的值,如何得到其对应表记录的ID号?
表名:myTab,字段:Id,Name,数据库连接字符串:ConnStr, VB.Net代码如下:
Dim ConnString As String = ConfigurationSettings.AppSettings("ConnStr")
Dim Conn As SqlClient.SqlConnection = New SqlClient.SqlConnection(ConnString)
Dim SQLAdp As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter
Dim DataSet As DataSet = New DataSet
Dim CmdTxt As String = "Select Id,Name From myTab"
Dim TabName As String = "myTab"
SQLAdp.SelectCommand = New SqlClient.SqlCommand(CmdText, Conn)
Conn.Open()
SQLAdp.Fill(DataSet, TabName)
Conn.Close()
Dim strName As String = me.TextBox1.Text '值为"张三"
Dim DT As DataTable = DataSet.Tables(TabName)
Dim SR As DataRow
MsgTxt = DataSet.Tables(TabName).Select("Name='strName'").IndexOf()
'到上面这一句就做不下去了,提示:没有可访问的IndexOf接受此数目的参数,因此重载决策失败。
'不知道剩下的该怎么做,请高手指点,谢谢!急!急!急!