[Mono-list] SqliteSyntaxException in Mono.Data.SqliteClient when doing SqliteCommand.ExecuteScalar()

jos_ junk at sonhult.se
Sun Jul 26 13:12:12 EDT 2009


As the subject says, I'm trying to ExecuteScalar() like this:

public static string GetScalarString(SqliteCommand cmd) {
	string result = "";
			
	using (SqliteConnection connection = new
SqliteConnection(connectionString)) {
		cmd.Connection = connection;
				
		object scalar = cmd.ExecuteScalar();
				
		if (scalar != null) {
			result = scalar.ToString();	
		}
	}
	
	return result;
}

But at the row cmd.ExecuteScalar() I get the following exception:

Unhandled Exception: Mono.Data.SqliteClient.SqliteSyntaxException: out of
memory
  at Mono.Data.SqliteClient.SqliteCommand.GetNextStatement (IntPtr pzStart,
System.IntPtr& pzTail, System.IntPtr& pStmt) [0x00000] 
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteReader (CommandBehavior
behavior, Boolean want_results, System.Int32& rows_affected) [0x00000] 
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteReader (CommandBehavior
behavior) [0x00000] 
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteReader () [0x00000] 
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteScalar () [0x00000] 

The SQL I have in cmd.CommandText is "SELECT Value FROM Settings WHERE Name
= ?1". My current workaround is to use the first row, first column in a
returned DataTable populated with SqliteDataAdapter.Fill(DataTable).

I get the same exception if I do cmd.ExecuteReader().

Any ideas?

Thanks in advance!
-- 
View this message in context: http://www.nabble.com/SqliteSyntaxException-in-Mono.Data.SqliteClient-when-doing-SqliteCommand.ExecuteScalar%28%29-tp24668619p24668619.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list