VB.Net中单选按钮的语法 [英] Syntax of Radio Button in VB.Net

查看:108
本文介绍了VB.Net中单选按钮的语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



朋友,我正在尝试将无线电信息放入数据库,但我没有得到它,向我显示错误

我写的代码是

Hi

Friends i am trying the radio information should go in data base but i am not getting it is showing me error

The code which i have writen is

Dim con As New SqlConnection
        Dim cmd As New SqlCommand
        con.ConnectionString = "Data Source=COMP-4\SQLEXPRESS;Initial Catalog=mesco;Integrated Security=True"
        cmd.Connection = con
        cmd.CommandText = "insert into donatetable(donateid,name,age,address,gender,moblieno,email,donationamt)values('"&textname.txt&"','"&txtage.txt&"','"&txtaddress.txt&"','"&RadioButton1.RadioButtonList.&"','"&rbfemale.Select&"','"&&"')"
    End Sub



可以利用无线电达顿作为男性和女性为vb.Net的插入代码提供帮助吗?甚至我正在使用 select @@ identity 进行自动ID生成,即使这给了我错误信息,请帮助
这是我的SQL查询



Can any one help me with the insert code for vb.Net using radio dutton as male and female. and even i am using select @@identity for auto ID generation even this is giving me error plz help
This is my sql query

create table donatetable 
(
name varchar(50),
donorid int,
gender varchar(5),
address varchar(50),
age int,
mobileno int,
email varchar(20),
donationamt int
)




请帮助我了解收音机的语法,它可以存储在数据库中
在此先感谢




Please help me out with the syntax of radio and it can store in the database
Thanks in advance

推荐答案

RadioButton1.RadioButtonList.&
我在这里看到了另外一个句号.这可能就是您遇到错误的原因.
确保要存储在表中的单选按钮的值与表列的类型相同.
RadioButton1.RadioButtonList.&
I see an additional fullstop here. That could be the reason why you are getting an error.

Make sure the value of the radio button to be stored in the table is the same as the table column type.


这是开始使用RadioButtonList
的方法
http://www.java2s.com/Code/ASP/Asp-Control/GetselectedradiobuttonfromradiobuttonlistC.htm [ ^ ]

而且,
& rbfemale.Select & "'',''" && "'')"
您在这里还有一个&
Here is the way to get started with RadioButtonList

http://www.java2s.com/Code/ASP/Asp-Control/GetselectedradiobuttonfromradiobuttonlistC.htm[^]

Moreover,
& rbfemale.Select & "'',''" && "'')"
you have an additional & here


在这里我发现了两个问题,

其中之一是"RadioButton1.RadioButtonList". ==>这是什么 .正在那里工作,

如果需要获取选定单选按钮列表"部分的值,请休息一下,然后rbfemale.Select将不起作用.您还需要编写rbFemale.SelectedValue.为此,如果从RadioButtonList中选择的值是一个字符串,则可以像``& YourValue&"''一样保留它,但是如果它是一个整数,则可以像这样保留它& YouValue&".只是检查一下这个东西.

另外,您要插入值的列数是8,而您提供的值是6.这两个数字必须相同.这也是原因.
如果可行,请尝试作为答案.
here I''m finding two issues in,

One is with "RadioButton1.RadioButtonList." ==> what this . is working there,

rest if you need to get value of the Selected Radio Button List part then rbfemale.Select will not work. you need to write rbFemale.SelectedValue .Also for this if the selected value from RadioButtonList is a string than it''s ok to keep it like ''"& YourValue &"'' but if its an integer than keep it like "& YouValue &". Just check this thing too.

One more thing the number of columns you are trying to insert values is 8 and the values you are providing is 6. This two numbers must be same. This is also the reason.

MArk as answer if it works.


这篇关于VB.Net中单选按钮的语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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