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;
}
}
}
Here you get more:
http://csharp.net-informations.com/data-providers/csharp-sql-server-connection.htm[
^]