Hello,
I have a MySQL query that I want to perform in a utility (not page) class. This query should fill up an array of string's and then return the array to the calling class. The array will then be base for new query's.
But I am not able to bind the result of a query to an string [] sArr variable while system array does not contain a definition for DataSource.
Is there anybody who can tell me if it is possible, and if so, how to fill up the string array with the result from the query without binding to page specific controls?
This is my class that does not work:
public static void GetNameInWOS(In t32 iWosID, string[] sNameArr)
{
string sRet="", strSQL="";
string myConnString = ConfigurationSe ttings.AppSetti ngs["DSN_Fyrr"];
MySqlConnection myConnection = new MySqlConnection (myConnString);
strSQL = "SELECT Name "
+ "FROM NameTypeDef"
+ "WHERE NameId = " + iWosID
+ " ORDER BY Name;";
MySqlDataAdapte r myDataAdapter = new MySqlDataAdapte r(strSQL, myConnection);
DataSet myDataSet = new DataSet();
myDataAdapter.F ill(myDataSet, "Name");
sNameArr.DataSo urce = myDataSet;
sNameArr.DataBi nd();
myConnection.Cl ose();
}
best regards
Kurt Jakobsen
I have a MySQL query that I want to perform in a utility (not page) class. This query should fill up an array of string's and then return the array to the calling class. The array will then be base for new query's.
But I am not able to bind the result of a query to an string [] sArr variable while system array does not contain a definition for DataSource.
Is there anybody who can tell me if it is possible, and if so, how to fill up the string array with the result from the query without binding to page specific controls?
This is my class that does not work:
public static void GetNameInWOS(In t32 iWosID, string[] sNameArr)
{
string sRet="", strSQL="";
string myConnString = ConfigurationSe ttings.AppSetti ngs["DSN_Fyrr"];
MySqlConnection myConnection = new MySqlConnection (myConnString);
strSQL = "SELECT Name "
+ "FROM NameTypeDef"
+ "WHERE NameId = " + iWosID
+ " ORDER BY Name;";
MySqlDataAdapte r myDataAdapter = new MySqlDataAdapte r(strSQL, myConnection);
DataSet myDataSet = new DataSet();
myDataAdapter.F ill(myDataSet, "Name");
sNameArr.DataSo urce = myDataSet;
sNameArr.DataBi nd();
myConnection.Cl ose();
}
best regards
Kurt Jakobsen
Comment