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


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Bind data from database to array

Posted By: Naresh     Posted Date: July 09, 2010    Points:2   Category :ASP.Net
HI,

I need to get id from database(sqlServer) and bind the id values to array.

If i insert the same id value it must show me message that id exits already.

Iam Using C#.net



Thanks in advance
Malathy.V

Responses
Author: Syed Shakeer Hussain             
Posted Date: July 12, 2010     Points: 5   

Hi,

 bool  flag = false;

ArrayList li=new Arraylist();
String strid="101";
//Here retrive the id from database.I hope you know how to retrive id using ado.net concept
if(li.Lenght>1)
{
for (int i = 0; i<li.Length ; i++)

{
if (strid == li.Items[i].Text)

{
Response.Write("Already Item Added");

flag =true;

}

}


if (flag == false)

{
li.Add(strid);

}

}

else

{

li.Add(strid);

}


Author: Naresh             
Posted Date: July 14, 2010     Points: 5   

HI,
Hussain thank u for ur reply.

Thanks
Naresh
Author: Syed Shakeer Hussain             
Posted Date: July 14, 2010     Points: 5   

Hi Naresh,
Is my code usefull for you or not...



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