Perl/C#????Oracle/SQL Server
???????????? ???????[ 2013/10/24 10:15:05 ] ????????
????2. C# ?????????
????C# ???????????·???
????1???????????????????????? 2???????????????SQL?????? 3??????SQL????????в??????????
??????????SQL Server??
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//connection-string(Local Server:127.0.0.1) & SQL-string define
string conString = "Server=(local); database=test; uid=sa; password=123456";
string sqlString = "select * from Monitor;";
//create a connection
SqlConnection con = new SqlConnection(conString);
con.Open();
//create a SQL command within connection?? use SqlDataReader(light-level) to read retrieved data
SqlCommand cmd = new SqlCommand(sqlString?? con);
SqlDataReader sdr = cmd.ExecuteReader();
while (sdr.Read())
Console.WriteLine("{0} {1} {2} {3}"?? sdr["ID"]??sdr["RecordTime"]??sdr["VideoView"]??sdr["Fluency"]);
con.Close();
cmd.Dispose();
//create a SQL command within connection?? use SqlDataAdapter to read retrieved data
con.Open();
SqlDataAdapter sda = new SqlDataAdapter(sqlString?? con);
DataSet dst = new DataSet();
sda.Fill(dst?? "Monitor");
foreach (DataRow row in dst.Tables["Monitor"].Rows)
Console.WriteLine(row["ID"] + " " + row["RecordTime"] + " " + row["VideoView"] + " " + row["Fluency"]);
con.Close();
Console.ReadKey();
}
}
}
?????????????????Server???????server??ip?????database?????????????????????SqlDataReader??SqlDataAdapter???????????????
???????????????????????????????????1?????????????????server???2????????server?????????????????????????sql????????table???
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11