错误 3 当前上下文中不存在名称“conn”
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;
namespace ConsoleApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
using (SqlConnection conn = new SqlConnection (
"Data Source=.;Initial Catalog=hospitalms;User ID Security==sa;Password=123456"));
{
conn.Open();
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}