从WinAPP asp.ent连接到数据库 [英] connect to database From WinAPP asp.ent
本文介绍了从WinAPP asp.ent连接到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请告诉我最好的方法,就是简单地在数据库中的1个表之间进行连接,并通过网格视图在Windows窗体应用程序上简单地显示它:( SQL DATABASE
please, any one tell me best way simply to connect between 1 table in database and display it simply on windows form application through grid view :( SQL DATABASE
推荐答案
这就是您想要的: www.macoratti.net/08/11/c_sql_m1. htm [^ ]
进入该网站,有可以帮助您的图像...
告诉我我是否帮助过您...
首先添加库:
This is what you want: www.macoratti.net/08/11/c_sql_m1.htm[^]
Go down of the web site, there are images that help you...
Tell me if I helped you or not...
First add the libraries:
using System.Data;
using System.Data.SqlClient;
然后:
Then:
<pre lang="c#">
namespace teste
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string connection = "Your Conection String";
SqlConnection conn = new SqlConnection();
SqlDataAdapter adapt = new SqlDataAdapter("Query SQL", conn);
DataSet ds = new System.Data.DataSet();
adapt.Fill(ds);
dataGridView1.DataSource = ds;
}
}
}
在这里您可以获得更多信息: http://csharp.net-informations.com/data -providers/csharp-sql-server-connection.htm [ ^ ]
Here you get more: http://csharp.net-informations.com/data-providers/csharp-sql-server-connection.htm[^]
这篇关于从WinAPP asp.ent连接到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文