rfid连接mysql_如何实现 RFID 数据与数据库连接?
string connectionString = @"Server=210.26.96.131; DATABASE=lnqGarbageSorting; UID=IOT1804; PWD = Intelligentize19916";
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
string strSql = "SELECT * FROM 用戶管理系統(tǒng)"; //要執(zhí)行的SQL語(yǔ)句
SqlCommand cmd = new SqlCommand(strSql, conn);
SqlDataAdapter da = new SqlDataAdapter(cmd); //創(chuàng)建DataAdapter數(shù)據(jù)適配器實(shí)例
DataTable dt = new DataTable("tablename");//創(chuàng)建DataSet實(shí)例
da.Fill(dt);//使用DataAdapter的Fill方法(填充)
dataGridView1.DataSource = dt.DefaultView;
conn.Close();//關(guān)閉數(shù)據(jù)庫(kù)
服務(wù)器名稱和數(shù)據(jù)庫(kù)名稱改了就可以了哦
string connectionString = @"Server=210.26.96.131; DATABASE=lnqGarbageSorting; UID=IOT1804; PWD = Intelligentize19916
總結(jié)
以上是生活随笔為你收集整理的rfid连接mysql_如何实现 RFID 数据与数据库连接?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: bash脚本程序语法Linux
- 下一篇: appcan ajax mysql_AP