sqlserver2012——.Net
时间:2021-07-01 10:21:17
帮助过:10人阅读
System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace SqlAdapter
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(
object sender, EventArgs e)
{
SqlConnection conn =
new SqlConnection();
conn.ConnectionString =
"Data Source=.;database=ADOSqlserverDemo;uid=sa;pwd=123456";
string sql =
"select * from 学生信息";
SqlCommand com =
new SqlCommand(sql,conn);
SqlDataAdapter da =
new SqlDataAdapter(com);
DataSet ds =
new DataSet();
da.Fill(ds, "学生信息");
dataGridView1.DataSource = ds.Tables[
"学生信息"];
dataGridView1.Refresh();
}
}
}
sqlserver2012——.Net
标签:wing dispose action ref visible bsp open eve timeout