0

just a small query..
.
.
i just want to know how to enter fetched data into an array..!!!

4
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by kameswari
0

do this:
1. Fetch the data from data base.
2. Have a loop to fill the data in array.

Post the code what ever you have done so far, for better help.

0
$checkExists = "select * from 0_ledger";  

$checkExists_result= mysql_query($checkExists)
   OR die('QUERY ERROR:<br />' .$checkExists. '<br />' .mysql_error());
   
$NumberOfResults=mysql_num_rows($checkExists_result);

i have fetch data into an array..!! Thanx

0

NO ans. uptil now.? :O i dont think it is that dificult..!!

0

hi sam... here i am fetching the data from the db and assing that data to a string array...
code is ...

protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(@"Data Source=WINKC185045-MAB\SQLEXPRESS;Initial Catalog=Records;Integrated Security=True");
        SqlDataAdapter da = new SqlDataAdapter("select name from data", con);
        DataSet ds = new DataSet();
        da.Fill(ds, "data");

        string[] s;
        s = new string[9];
               

        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            s[i] = ds.Tables[0].Rows[i][0].ToString();
            Response.Write(s[i]);
            
        }

              
    }

Hope it helps u.....let me know if u face any difficulties...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.