.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
satyapriyanayak
SP
abhays
Sasi Prabhu

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

to save data from listbox to database

Posted By: kalyan     Posted Date: March 23, 2010    Points:2   Category :C#
how to save data in RADLISTbox to database ... all the list ot items in that box want to store in data base.....

Responses
Author: Amit Mehra             
Posted Date: March 24, 2010     Points: 5   

HI,

I guess you are using telerik ListBox control if yes than please take a look at this sample code


http://demos.telerik.com/aspnet-ajax/listbox/examples/populatingwithdata/databaseupdate/defaultcs.aspx

Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: Syed Shakeer Hussain             
Posted Date: March 24, 2010     Points: 5   

Hi,
suppose you have items in a list box.
Add submit button and write the code in it as follows:
for (int i = 0; i < ListBox1.Items.Count; i++)
{
ListItem li = new ListItem();
li.Text = ListBox1.Items[i].Text;
li.Value = ListBox1.Items[i].Value;
SqlCommand cmd=new SqlCommand("insert into tablename(listcolmText,listcolmValue) values('"+li.Text +"',"+ li.Value +")",conn);
cmd.ExecuteNonQuery();

}


Author: Lalij Mer             
Posted Date: March 25, 2010     Points: 5   

You need to add it in a data set and do update() to DB.

check the below sites to know more

http://www.microsoft.com/downloads/details.aspx?FamilyID=a23f60b6-a75d-45a3-8200-7f5e396558ed&displaylang=en


Please Check my answer if you help....
Thank You...

Lalit.


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend