
c#出错 未将对象引用设置到对象的实例。
privatevoid维修项目ComboBox_SelectedIndexChanged(objectsender,EventArgse){DataTableMyTabl...
private void 维修项目ComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
DataTable MyTable = new DataTable();
String MySQLConnectionString = global::jiadianweixiu.Properties.Settings.Default.DBServiceConnectionString;
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
string MySQL = "SELECT * FROM 维修报价 WHERE 报价编号='" + 维修项目ComboBox .SelectedValue.ToString()+ "'";
这句提示 未将对象引用设置到对象的实例
MyConnection.Open();
SqlDataAdapter MyAdatper = new SqlDataAdapter(MySQL, MyConnection);
MyAdatper.Fill(MyTable);
this.维修费用TextBox.Text = MyTable.Rows[0]["维修报价"].ToString();
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
} 展开
{
DataTable MyTable = new DataTable();
String MySQLConnectionString = global::jiadianweixiu.Properties.Settings.Default.DBServiceConnectionString;
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
string MySQL = "SELECT * FROM 维修报价 WHERE 报价编号='" + 维修项目ComboBox .SelectedValue.ToString()+ "'";
这句提示 未将对象引用设置到对象的实例
MyConnection.Open();
SqlDataAdapter MyAdatper = new SqlDataAdapter(MySQL, MyConnection);
MyAdatper.Fill(MyTable);
this.维修费用TextBox.Text = MyTable.Rows[0]["维修报价"].ToString();
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询