Click here to Skip to main content
15,904,877 members

Comments by Member 9772922 (Top 7 by date)

Member 9772922 19-Feb-13 14:11pm View    
i am storing the retrieved customerid(1,2) into an array which inside a while loop and later when i try to retrieve the values from the array it is showing wrong values(2 and 0)
I am not able to understand what is happening?
and here is the code
string cust = "select distinct(customerid) from customerpaper";
SqlCommand custcmd = new SqlCommand(cust, con);

sda = custcmd.ExecuteReader();

if (sda.HasRows)
{
while (sda.Read())
{
i = 0;
customerid[i] = Convert.ToInt32(sda.GetValue(0).ToString());

listBox1.Items.Add(customerid[i]); //customerid 1 and 2 is stored


custid = customerid[i];
//textBox1.Text = custid.ToString();

// absent1(custid, customercoun);
// listBox1.Items.Add(customerid[i]);
i = i + 1;

}
}
sda.Close();

for (int j = 0; j < 10;j++ )
{

listBox2.Items.Add(customerid[j]);//customerid 2 and 0 is being retrieved
}
Member 9772922 29-Jan-13 8:07am View    
By the way i am using vs2010 and sql server r2 2008
Member 9772922 29-Jan-13 7:59am View    
In customer interface i have a combobox from where the user selects the paper for a particular customer.Now how i will retrieve the paperid from the selected paper.I also have a listbox next to combobox to show the selected paper plz help me out.
Member 9772922 28-Jan-13 1:00am View    
Im facing another problem as you said to create a third table with id,custid and paperid,how to retrieve the custid from the customer table in the third table
Member 9772922 27-Jan-13 9:14am View    
I have another table for paper where i have paperid,papername and the dealer id with whom i buy from.The idea behind to think this was that by doing this i thought of reducing the number of rows for eg:if all the client take 3 paper suppose and there are 1000 customers then it will take 3000 rows so i thought of just reducing it