看板 C_Sharp 關於我們 聯絡資訊
最近剛學C# 且我沒有程式底子 目前我在學習如何讀出資料與寫入 也找MSDN跟骨狗聊了一星期也是不懂 目標:我想要從SQLCE中讀出資料並在DATAGRID中顯示出來,然後修改完再回存 使用工具:2008 studio & sql2008 r2(.sdf) &.net3.5 麻煩有經驗的大大指點迷經 謝謝 private void dataGrid1_CurrentCellChanged(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(); conn.ConnectionString = "Server=localhost;database=testDB;uid=TT ;pwd=123 ;"; string cmd = "SELECT * FROM aaa"; SqlDataAdapter da = new SqlDataAdapter(cmd, conn); DataSet ds = new DataSet(); da.Fill(ds, "sss"); System.Data.DataTable myDataTable = ds.Tables["sss"]; label1.Text = myDataTable.Rows[0][0].ToString(); } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.70.47.36