回复 16# 的帖子
我的是这样
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace YSCK
{
public partial class cpin : Form
{
public cpin()
{
InitializeComponent();
}
private void cpin_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“dataSet1.UserLoad”中。您可以根据需要移动或移除它。
SqlConnection conn = new SqlConnection("user id=sa;password=3927;Database =YSCK;data source=127.0.0.1;Connect Timeout=30");
conn.Open();
//SqlCommand cm = new SqlCommand("select * from userload",conn);
SqlDataAdapter da = new SqlDataAdapter("select * from cpindtl", conn);
DataSet dt = new DataSet();
da.Fill(dt, "cpindtl");
this.dataGridView1.DataSource = dt.Tables["cpindtl"].DefaultView;
conn.Close();
//
//加载操作员数据
//
SqlDataAdapter da1 = new SqlDataAdapter("select name from userload", conn);
DataSet dt1 = new DataSet();
da1.Fill(dt1, "userload");
//
//给comboBox1(开单人)绑定数据
//
= "name";
= "name";
= dt1.Tables["userload"];
.Text ="--请选择";
}
private void button3_Click(object sender, EventArgs e)
{
this.Close();
return;
}
}
}