0
客戶歡迎頁面從賬戶請求客戶ID
我想連接2個表單,1當您單擊go按鈕時,表單將轉到表單#2並將列表顯示在表格中。將列表形式連接到生成表格的表格
表1:發生在熙從帳戶表:http://puu.sh/hnp4G/eeb8da0a87.png
public partial class WelcomeCust : Form
{
OleDbConnection db = new OleDbConnection();
OleDbDataAdapter da = new OleDbDataAdapter();
DataTable dt = new DataTable();
public WelcomeCust()
{
InitializeComponent();
db.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\ChattBankMDB.mdb";
}
private void button1_Click(object sender, EventArgs e)
{
//Code for looking up the
using (OleDbCommand da = new OleDbCommand("select Cid From Accounts", db))
{
db.Open();
DataTable schema = db.GetSchema("Tables");
List<Accounts> TableNames = new List<Accounts>();
foreach (DataRow row in schema.Rows)
{
TableNames.Add(row[0].ToString());
}
da.Parameters.AddWithValue("@Cid", textBox1.Text);
da.ExecuteNonQuery();
return TableNames;
db.Close();
}
}
表2:顯示你的賬戶表:http://puu.sh/hnpgr/e1d31930cf.png
public partial class CustomerAccounts : Form
{
public CustomerAccounts()
{
InitializeComponent();
}
private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e)
{
}
}
}
TableNames.Add(row[0].ToString());
和return TableNames();
給我的錯誤以及:
Error 2 Argument 1: cannot convert from 'string' to 'ChattBank.Accounts'
Error 3 Since 'ChattBank.WelcomeCust.button1_Click(object, System.EventArgs)' returns void, a return keyword must not be followed by an object expression