如何从SQL插入和检索数据到C#窗口 [英] How to insert and retrieve data from sql to c# window
本文介绍了如何从SQL插入和检索数据到C#窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮助.
我在strconnectionstring上遇到错误.
这段代码用于执行动作查询sqlcommand:
Please help.
I am getting an error on strconnectionstring.
This code is to execute action queries sqlcommand:
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = strconnectionstring;
cnn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = cnn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "update measurementunit measurement=@measurment, mucode =@mucode";
SqlParameter p1 = new SqlParameter("@measurment", txtmu.Text);
SqlParameter p2 = new SqlParameter("@mucode", txtmucode.Text);
cnn.Close();
推荐答案
如果非常紧急,则可以使用LINQ to SQL.
请检查以下链接:
http://www.codeproject.com/KB/linq/LINQSQLCS.aspx [ ^ ]
If it is very urgent then you can use LINQ to SQL.
Please check the following link:
http://www.codeproject.com/KB/linq/LINQSQLCS.aspx[^]
请检查以下链接:
http://dotnetperls.com/datatable [ ^ ]
请查看以下教程:
http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson03.aspx [ ^ ]
Please check the following link:
http://dotnetperls.com/datatable[^]
Please check the following tutorial:
http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson03.aspx[^]
另一个面向初学者的指南:
http://www.codeproject.com/KB/database/sql_in_csharp.aspx
Another guide for beginners:
http://www.codeproject.com/KB/database/sql_in_csharp.aspx
这篇关于如何从SQL插入和检索数据到C#窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文