C#2010提示上下文不存在名称sendstrsql还有link。。。求解!!!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 航空机票预订管理系统
{
public partial class passenger : Form
{
public passenger()
{
InitializeComponent();
}
private void selbtn_Click(object sender, EventArgs e)
{
sendstrsql="SELECT 旅客.身份证号 FROM 旅客";
DataTable dt1=link.dsresult(sendstrsql);
dataGridView1.DataSource=dt1.DefaultView;
}
private bool checkEmpty()//判断四个textbox是否均有输入信息
{
bool result = true;
if (txt_addCname.Text.Trim() == string.Empty)
result = false;
else if (txt_addCsex.Text.Trim() == string.Empty)
result = false;
else if (txt_addCno.Text.Trim() == string.Empty)
result = false;
else if (txt_addCtele.Text.Trim() == string.Empty)
result = false;
return result;
}
private void btn_add_Click(object sender, EventArgs e)
{
if(checkEmpty()==true)//当四个textbox均输入时,才进行插入操作
{try{
sendstrsql="INSERT INTO passenger VALUES('"+ txt_addCname.Text+"','"+ txt_addCsex.Text+"','"+ txt_addCno.Text+"','"+ txt_addCtele.Text+"')";
link.updatedb(sendstrsql);
MessageBox.Show("成功插入数据");}
catch(