新手请教:帮忙改下这个登录程序的错误!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using System.Data.SqlClient;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == " " || textBox2.Text == " ")
{
MessageBox.Show( "请输入用户名和密码,然后再登录 ");
return;
}
string SQL = "select Power from ID where UserID = ";
SQL += textBox1.Text + " and Power = ' " + textBox2.Text.Trim() + " ' ";
string myConStr = "Persist Security Info=False;Initial Catalog=mydata; ";
myConStr += "Data Source=localhost;Integrated Security=SSPI; ";
SqlCommand myCom = null;
SqlConnection myCon = null;
try
{
myCon = new SqlConnection(myConStr);
myCon.Open();
myCom = new SqlCommand(SQL, myCon);