这是我的C#程序,显示如下错误,求指教:错误 1 “string”不包含“DBHelper”的定义,并且找不到可接受类型为“string”的第一个参数的扩展方法
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;
using System.Data.SqlClient;
using System.Net.NetworkInformation;
namespace 实验窗体
{
public partial class FrmMain : Form
{
public FrmMain()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DBHelper.conn.Open();
string sql = @"insert into [XSB](学号,姓名,性别)
values('" + textBox1.Text + " ','" + textBox1.Text + " ','" + textBox1.Text + " ',)";
SqlCommand cmd = new SqlCommand ( sql.DBHelper.conn);
int resultLine = cmd .ExecuteNonQuery ();
if ( resultLine > 0 )
{
MessageBox.Show("输入成功");
}
else
{
MessageBox.Show("输入成功");
}
DBHelper.conn.Close();
}
}
}