The online racing simulator
InSim with Mysql (Spark library on mono)
Can anyone make for me an example code to select column bl1_xfg from database zgloszenia server 123.456.789.123, user: test and pass asdqwe123qweasd. I'm using Spark library on Command Line Application runnig by mono on Debian Lenny.
#2 - filur
Yeah I can use google but I was asking for example. I'm very busy so learning now from websites isn't best for me. Better is to see a code and analyze it. Faster and easier - for me.
using System;
using System.Data;
using MySql.Data.MySqlClient;

public class Test
{
public static void Main(string[] args)
{
string connectionString =
"Server=123.456.789.123;" +
"Database=zgloszenia;" +
"User ID=test;" +
"Password=asdqwe123qweasd;" +
"Pooling=false";
IDbConnection dbcon;
dbcon = new MySqlConnection(connectionString);
dbcon.Open();
IDbCommand dbcmd = dbcon.CreateCommand();
string sql =
"SELECT bl1_xfg FROM tablename";
dbcmd.CommandText = sql;
IDataReader reader = dbcmd.ExecuteReader();
while(reader.Read()) {
string bl1_xfg = (string) reader["bl1_xfg"];
Console.WriteLine("bl1_xfg: " + bl1_xfg);
}
// clean up
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
}
}

Note, you didn't provide the table name, so I just stuck in tablename. I also don't *know* any of the .NET framework or mono. I'm also very busy.

P.S. This is basically the first result from google, with the sql changed.
So I have to take time at night and try it. Thanks @the_angry_angel. I'll test it and post here working code. The table is kierowcy

EDIT:
I need Mysql Connector for C#, yes?
Yes you will need the MySql Connector for .net to be able to run the application.

FGED GREDG RDFGDR GSFDG