有么有人知道啊
要求 写出类名 函数名 大致框架就好了~~~
..大家帮帮我吧~~~~~
俺给一个老师的程序...是参考程序
public static void ExecuteSql(string source)
{
string select = "SELECT ContactName,CompanyName FROM Customers";
try
{
using (SqlConnection conn = new SqlConnection(source))
{
conn.Open();
SqlCommand cmd = new SqlCommand(select, conn);
using (SqlDataReader reader = cmd.ExecuteReader())
{
Console.WriteLine("*** SqlProvider ***");
Console.WriteLine("Output from direct SQL statement...");
Console.WriteLine();
Console.WriteLine("CONTACT COMPANY");
Console.WriteLine("--------------------------------------");
while (reader.Read())
{
Console.WriteLine("{0,-30} {1}", reader[0], reader[1]);
}
reader.Close();
}
conn.Close();
}
}
catch (Exception e) { Console.WriteLine(e.ToString()); }
}