using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Da
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Da
namespace WindowsApplication17
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
SqlConnection con=new SqlConnection ("Server=localhost\\SQLEXPRESS;Database=开销;User ID=sa;Password=110;Trusted_Connection=False");
con.Open ();
DataSet ds =new DataSet ();
SqlDataAdapter da = new SqlDataAdapter("select top 0 * from test1", con);
da.Fill(ds, "test1");
for (int i = 1; i < 40; i++)
{
DataRow dr = ds.Tables["test1"].NewRow();
dr["id"] = i;
dr["name"] = Convert.ToChar(i);
ds.Tables["test1"].Rows.Add(dr);
Console.WriteLine(Convert .ToChar(i));
}
SqlCommandBuilder cb = new SqlCommandBuilder(da);
da.Update(ds.Tables["test1"]);
MessageBox.Show("ok");
}
}
}