Last post Jun 16, 2010 03:39 PM by kjoe
Jun 15, 2010 11:45 PM|kjoe|LINK
I followed the tutorial at 15 seconds on how to set up the database and run a mysql query to get a datagrid like
my question would be is it possible in asp.net to grab say the word Hello out of a mysql query? I've been looking around for tutorials on how to do it all evening and came up with nothing. I'm working on a website and I'd like to make variables with like
a users name, email, ect to put in different places on my page. I think I understand how to pull" hello" out of the query..
My problem is I can only pull it out in an excel like format with the box around it. Is there anyway to make a variable = what is inside that box? Thanks in advance
Jun 16, 2010 02:34 AM|Waqar_ali|LINK
I think you have used following tutorial
In this tutorial you are getting a data in object datasource, you can also get data in DataTable from which you can easily read any particular row data.
just simly using page load code of this tutorial
protected void Page_Load(Object sender, EventArgs e)
MySqlConnection myConnection = new MySqlConnection(
"server=localhost; user id=15secs; password=password; database=mydatabase; pooling=false;");
String strSQL = "SELECT * FROM mytable;";
MySqlDataAdapter myDataAdapter = new MySqlDataAdapter(strSQL, myConnection);
DataSet myDataSet = new DataSet();
MySQLDataGrid.DataSource = myDataSet;
In this code you can also get data from myDataSet.
simply write code
string str = myDataset.Tables.Rows["columnName"].ToString();
Please correct me if i understand wrong your problem.
Jun 16, 2010 01:51 PM|kjoe|LINK
That worked. Thank you for your help
Jun 16, 2010 03:01 PM|Waqar_ali|LINK
Please mark as answer if it solved your problem.
Jun 16, 2010 03:39 PM|kjoe|LINK
oh, sounds good. Done