MYSQL TABLE RECORDS TO ARRAY
-
am looking for a way i can loop through records in mysql table and place the records in an array ...Kindly help
Continue it like this,
- Get the records from your database, using a
SELECT
clause. - Save that response into a variable of type array (or a generic list).
Which language are you actually using? C#, Java, C++, PHP? It depends on which framework and language you're using. The language would allow you to perform such actions on the objects (or the list of the object) that is being returned. Usually results from the database are in a form of an array or list.
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
- Get the records from your database, using a
-
Continue it like this,
- Get the records from your database, using a
SELECT
clause. - Save that response into a variable of type array (or a generic list).
Which language are you actually using? C#, Java, C++, PHP? It depends on which framework and language you're using. The language would allow you to perform such actions on the objects (or the list of the object) that is being returned. Usually results from the database are in a form of an array or list.
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
- Get the records from your database, using a
-
Continue it like this,
- Get the records from your database, using a
SELECT
clause. - Save that response into a variable of type array (or a generic list).
Which language are you actually using? C#, Java, C++, PHP? It depends on which framework and language you're using. The language would allow you to perform such actions on the objects (or the list of the object) that is being returned. Usually results from the database are in a form of an array or list.
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
- Get the records from your database, using a
-
am looking for a way i can loop through records in mysql table and place the records in an array ...Kindly help
-
am looking for a way i can loop through records in mysql table and place the records in an array ...Kindly help
public void GetDatainArr()
{
string strSQl = "";
string[] Arr = new string[50];
strSQl = "select [Id] from [tblname] ";
DataTable dt = GetDataTable(strSQl); //GetDataTable function
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
Arr[i] = Convert.ToString(dt.Rows[i][0]);
}
}
}
public DataTable GetDataTable(string Sql)
{
SqlConnection conn = new SqlConnection("ConnectionString ");
conn.Open();
DataTable dt = new DataTable();
SqlCommand cmd = new SqlCommand(Sql, conn);
SqlDataAdapter ad = new SqlDataAdapter();
ad.Fill(dt);
conn.Close();
return dt;
}This code in C# so you can Convert this code in vb using this link http://www.developerfusion.com/tools/convert/csharp-to-vb/
Sanket Gandhi