|
-
November 11th, 2008, 04:28 PM
#1
Array problem
Hello everyone,
I'm trying to make an array from the return of a MySQL query but keep getting the following error message:
Error 1 Use of unassigned local variable 'QueryArray'
The line it refers to is the "return QueryArray;"
I keep trying different methods to try and get this to work but I'm getting no where.. So any help would be much appreciated. It's a generic query handler I'm making, so I don't know how big the array is going to be before the query is executed..
Code:
public static string[][] ReturnQueryArray(MySql.Data.MySqlClient.MySqlConnection Source, string SQLQuery)
{
MySql.Data.MySqlClient.MySqlCommand MyQuery = Source.CreateCommand();
MySql.Data.MySqlClient.MySqlDataReader Reader;
MyQuery.CommandText = SQLQuery;
Reader = MyQuery.ExecuteReader();
int counter = 0;
string[][] QueryArray;
while (Reader.Read())
{
for (int i = 0; i < Reader.FieldCount; i++)
{
QueryArray[counter][i] = Reader.GetValue(i).ToString();
}
counter = counter + 1;
}
return QueryArray;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|