using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace RenterManage
{
public partial class Renter : Form
{
public Renter()
{
InitializeComponent();
this.sqlConnection1 = new SqlConnection(database.dbconnection.conncetion);
this.sqlCommand1 = new SqlCommand();
this.sqlCommand1.Connection = this.sqlConnection1;
this.add = false;
rentermanage = new RenterManage();
}
private void Renter_Load(object sender, EventArgs e)
{
this.strSql = "Select RenterName 姓名,Contact 联系方式,ContractID 合同编号," + "RenterRental 出租人租金,Remark 备注, RenterID 出租人编号" + "from Renter";
this.FillDataGrid(strSql);
}
private void FillDataGrid(string sql)
{
if (this.sqlConnection1.State == ConnectionState.Closed)
this.sqlConnection1.Open();
Console.WriteLine(sql);
SqlDataAdapter adapter = new SqlDataAdapter(sql,sqlConnection1);
ds = new DataSet("t_renter");
adapter.Fill(ds,"t_renter");
this.dataGrid1.SetDataBinding(ds,"t_renter");
}
}
}调试会出来异常,Renter附近出现语法错误
|