我有一个令牌号列,即数据类型为int [英] i have a column of token no, that is data type int
本文介绍了我有一个令牌号列,即数据类型为int的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一列令牌号,这是数据类型int和形式我有一个组合框,它有令牌号1,2,3,4 ..............我想要在令牌no的基础上搜索数据,即我有一些错误
i have a column of token no, that is data type int and in form i have a combobox its having token no 1,2,3,4.............. i want to search data on the base of token no i.e 1 but i having some error
Syntax error converting the varchar value 'System.Data.DataRowView' to a column of data type int.
please help i am code which is below
<pre lang="vb">myconn = New SqlConnection("data source=nic-bpdc;Initial Catalog=pension;integrated security=sspi;")
myconn.Open()
cmd.Connection = myconn
cmd.CommandText = ("select ppo_no from billentry where token_no ='" & ComboBox1.Text & "'")
'cmd.CommandText = ("select ppo_no, p_name,sec,billdate,state from billentry where token_no ='" & ComboBox1.Text & "'")
rd = cmd.ExecuteReader()
While (rd.Read())
TextBox5.Text = rd!ppo_no
'TextBox4.Text = rd!p_name
''TextBox3.Text = rd!billamount
'ComboBox4.Text = rd!sec
'DateTimePicker2.Text = rd!billdate
'TextBox2.Text = rd!state
End While
'rd.Close()
myconn.Close()</pre>
推荐答案
ChauhanAjay给出了正确答案注释(使用.SelectedValue,而不是.Text),所以问题已经回答了!
ChauhanAjay gave the correct answer in a comment (use .SelectedValue, not .Text), so the question has been answered!
这篇关于我有一个令牌号列,即数据类型为int的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文