有人可以给我提供示例代码吗 [英] Could some one provide me a sample code
本文介绍了有人可以给我提供示例代码吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请问有人可以给我提供从数据库中获取数据的代码吗?
Could some one plz provide me the code to fetch the data from the database??
推荐答案
嗨
这是C#的示例
Hi
Here is the example of C#
string strDBConnection = "Data Source=Localhost;Initial Catalog=Employee;Persist Security Info=True;User ID=sa;Password=1";
string strCommandText = "SELECT * FROM EMP";
SqlConnection SConnection = new SqlConnection(strDBConnection);
SqlCommand cmd = new SqlCommand(strCommandText, SConnection);
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(strCommandText, SConnection);
DataSet ds = new DataSet();
sqlDataAdapter.Fill(ds);
谢谢,
Imdadhusen
Thanks,
Imdadhusen
您可以从此处开始 [ ^ ].
还可以尝试msdn.您应该在那里获得一些基本样本.
You could start from here[^].
Also try out msdn. You should get some basic samples there.
朋友,
请参阅此CP文章使用C#读取,插入,更新和删除简单的ADO.NET数据库. [ ^ ]
Google永远是您的朋友.请参阅 ^ ]此处(只需在C#中添加您的标题并用Google搜索).请参见这些链接.可能会有所帮助
使用C#.NET检索数据 [
Hi Friend,
See This CP article Simple ADO.NET Database Read, Insert, Update and Delete using C#.[^]
Google is always friend of you. See Google Results [^]here (Just am added C# your title & googled it.) See these links. Might be helpful
Retrieving Data Using a C# .NET[^]
这篇关于有人可以给我提供示例代码吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文