[Mono-devel-list] ByteFX in mono using the mysql command builder

Jason Starin | Giant Head jasonstarin at giant-head.com
Tue Dec 14 08:31:26 EST 2004


 
 
 
 
 
<<
  Could you please send us a sample minimal code to reproduce this
  behaviour? That will be helpful.


Thanks
suresh.>>


Is this enough to diagnose my problem?  The first string pulls the data and
sends the dataset names to another string that populates the form.  Those
dataset are accessible from that form.  The submit button alters the
datasets with the current form data, and then calls the second string which
tries to update the database with the command builder and the adapters.





This string is loaded in an on load event.  The first dataset is


private string databaseconnector1(string IDgetter2, string
connectionstring1, DataSet dataset1update, DataSet dataset2update)
		{				
		   try
			{
				MySqlConnection Core_dataeditconnection =
new MySqlConnection(connectionstring1);
				//For security Reasons I generate a special
connection string to access the database on load and pass and
//expire it in a cookie
				string selectStatement1 = "SELECT * FROM
interupts_T3 i WHERE i.Core_dataID = '" + IDgetter2 + "'";
				MySqlCommand GetCore_dataInfo = new
MySqlCommand(selectStatement1);
				MySqlDataAdapter Core_dataeditAdapter = new
MySqlDataAdapter(selectStatement1, connectionstring1);
				GetCore_dataInfo.CommandText =
selectStatement1;
				Core_dataeditconnection.Open();
	
Core_dataeditAdapter.Fill(dataset1update,0,1,"interupts_T3");
			    	Core_dataeditconnection.Close();
				string Core_datanameselect =
dataset1update.Tables[0].Rows[0]["Core_dataName"].ToString();
				string selectstatement2 = "SELECT * FROM
categories3 c WHERE c.Core_dataName = '" + Core_datanameselect + "'"; 	
				GetCore_dataInfo.CommandText =
selectstatement2;
				MySqlDataAdapter Core_dataeditAdapter1 = new
MySqlDataAdapter(selectstatement2,connectionstring1);
				Core_dataeditconnection.Open();
	
Core_dataeditAdapter1.Fill(dataset2update,0,1,"categories3");
				Core_dataeditconnection.Close();
	
PopulateFormDataCore_UTs123(dataset1update,dataset2update);
			}
		   catch
			{
			  return "0";
			}

                  }

The above function just loads the two datasets

This function is the one I'm having trouble with:

private string databaseupdater1(DataSet dataset1update, DataSet
dataset2update, string updateconnectionstring1) 
//the datasets have been adjusted by the submission of the
//web form, and as a last step the database is altered with this string
{       
            string selectstring1 = "SELECT * FROM interupts_T3 i WHERE
i.Core_dataID = '" + Core_dataID.Text.ToString() + "'"; 
	    string selectstring2 = "SELECT * FROM categories3 c WHERE
c.Core_dataName = '" + Core_dataName.Text.ToString() + "'";

	try
       		{
               		MySqlConnection Finishconnection = new
MySqlConnection(connectionstring1);
			MySqlDataAdapter Finishadapter1 = new
MySqlDataAdapter(selectstring1,connectionstring1);
			MySqlDataAdapter Finishadapter2 = new
MySqlDataAdapter(selectstring2,connectionstring1);
			Finishconnection.Open();
			MySqlCommandBuilder Finishediting1 = new
MySqlCommandBuilder(Finishadapter1,true);
			MySqlCommandBuilder Finishediting2 = new
MySqlCommandBuilder(Finishadapter2,true);
			Finishadapter1.Update(dataset1update,
"interupts_T3");  
			Finishadapter2.Update(dataset2update,
"categories3"); 
			Finishconnection.Close();
          	}
	catch 
		{
			return "0"; 
		}
}


Any insight would be appreciated....
		
Thanks,
Jason
				





More information about the Mono-devel-list mailing list