如何基于下拉列表值在表中保存文本框值 [英] How to save Textbox value in a table based on dropdownlist value
本文介绍了如何基于下拉列表值在表中保存文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨......
我在asp.net中更新鲜。
我有一个DropDownList(DDLState)和一个Textbox(txtCity)。
表(市)有三栏:
City_ID
City_Name
State_Id
我想基于StateId保存表(City)中文本框(txtCity)的值,并且State_ID由DropDownList(DDLState)的选定值生成。我该怎么办?
请帮助...
对不起我的英语............
非常感谢...
解决方案
您可以编写简单的查询,以便在城市表中插入值,如下所示。
sqlCommand Cmd = new SqlCommand( 插入城市(City_Name,State_Id)值(' + TextBoxCity.Text + ',' + DropdownListState.selectedValue.ToString()+ ')跨度>,ConnectionObject);
hi...
I am fresher in asp.net.
I have one DropDownList(DDLState) and one Textbox(txtCity).
Table(City) has Three Columns:
City_ID
City_Name
State_Id
I want to save value of a textbox(txtCity) in a table(City) based on StateId AND The State_ID is generated by selected value of DropDownList(DDLState). How can i do ?
Pls Help...
Sorry for my English............
Thanks a lot...
解决方案
You can write simple query for inserting the values in city table as per below.
sqlCommand Cmd= new SqlCommand("Insert into city(City_Name,State_Id) values('"+TextBoxCity.Text+"','"+DropdownListState.selectedValue.ToString()+"')",ConnectionObject);
这篇关于如何基于下拉列表值在表中保存文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文