|
-
May 16th, 2012, 06:58 AM
#1
MySQL and C#
I have problem that I cannot reach my data bases trought my c# project.
Im using latest versions of .Net and MicrosoftVisual C# 2010 Express, XAMPP for apache and MySql, connector from the MySQL folder. The program says Unknown database "name". I have made this database in phpmyadmin panel and c it working just cant reach it. Please help me. There is the cs :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
namespace bazaffs
{
class Program
{
static void Main(string[] args)
{
try
{
MySqlConnection conn = new MySqlConnection("Server=127.0.0.1;Port=3306;Database=aaa;Uid=root;Pwd=root;");
conn.Open();
MySqlCommand command = conn.CreateCommand();
command.CommandText = "Select * from bbb ";
MySqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(reader.ToString());
}
Console.ReadLine();
conn.Close();
}
catch (Exception ex)
{
Console.Write(ex.Message.ToString());
Console.ReadLine();
}
}
}
}
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
|