VB.net中如何将变量赋值为ACCESS查询出来之后的一个具体值 20
比如a赋值为textbox输入的“AAA”(为碱基序列‘rID),那么需要使b赋值为赖氨酸(即rcName中的对应值),代码该怎么写?...
比如a赋值为textbox输入的“AAA”(为碱基序列‘rID),那么需要使b赋值为赖氨酸(即rcName中的对应值),代码该怎么写?
展开
1个回答
展开全部
但用ExecuteScalar就够了,而且效率更高
Dim myDate As string
Dim conn As SqlConnection = New SqlConnection("Server=(local);DataBase=test;Uid=sa;Pwd=123")
Dim sql As String = "SELECT adjustdate FROM plupos AS WHERE barcode = xxx "
Dim cmd As New SqlCommand(sql, conn)
conn.open
myDate=cmd.ExecuteScalar().tostring
conn.Close()
Dim myDate As string
Dim conn As SqlConnection = New SqlConnection("Server=(local);DataBase=test;Uid=sa;Pwd=123")
Dim sql As String = "SELECT adjustdate FROM plupos AS WHERE barcode = xxx "
Dim cmd As New SqlCommand(sql, conn)
conn.open
myDate=cmd.ExecuteScalar().tostring
conn.Close()
追问
这是另一个跟我的问题有一点出入的问题的答案啊。。。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询