Reading from a mysql database and converting it to a string
I have mucho grande problema.
I Need to read 4 Collums from a mysql database and put it in string. I
have allready established a mysql connection and i can fill the database
with c#.
database consists of 1 table: files with 4 columns: 1 name 2 size 3 last
edit 4 extenstion i need to read 1 name 2 size 3 last edit 4 extenstion
out of the database and convert them to strings.
here is my code:
static void querry()
{
String sourcedatabase = ConfigurationManager.AppSettings[@"Database1"];
String targetdatabase = ConfigurationManager.AppSettings[@"Database2"];
var connection = new MySqlConnection("server=localhost;user
id=******;password=******;database=" + sourcedatabase + ";");
try
{
connection.Open();
MySqlCommand cmd = new MySqlCommand(query, connection);
cmd.ExecuteNonQuery();
connection.Close();
}
catch (Exception )
{
logger("MySql connection error");
}
}
No comments:
Post a Comment