我有一个令牌号列,即数据类型为int [英] i have a column of token no, that is data type int

查看:92
本文介绍了我有一个令牌号列,即数据类型为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(&quot;data source=nic-bpdc;Initial Catalog=pension;integrated security=sspi;&quot;)
        myconn.Open()
        cmd.Connection = myconn
        cmd.CommandText = (&quot;select ppo_no from billentry where token_no =&#39;&quot; &amp; ComboBox1.Text &amp; &quot;&#39;&quot;)

        &#39;cmd.CommandText = (&quot;select ppo_no, p_name,sec,billdate,state from billentry where token_no =&#39;&quot; &amp; ComboBox1.Text &amp; &quot;&#39;&quot;)
        rd = cmd.ExecuteReader()
        While (rd.Read())
            TextBox5.Text = rd!ppo_no
            &#39;TextBox4.Text = rd!p_name
            &#39;&#39;TextBox3.Text = rd!billamount
            &#39;ComboBox4.Text = rd!sec
            &#39;DateTimePicker2.Text = rd!billdate
            &#39;TextBox2.Text = rd!state
        End While
        &#39;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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆