哪位大婶或者大牛可以帮我详细的帮我解释一下吗 就讲解前面BUTTON2就可以了 是不是每用到一个控件就要在控件后面加以个方法之类的? 谢谢
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DBTranning
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void tabPage3_Click(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
SqlConnection MyConn = new SqlConnection(); //
DBConnect dbConn = new DBConnect();
string sql = "";
MyConn = dbConn.DBConnection("FaiDB");
if (MyConn.State != ConnectionState.Open)
{
try
{
MyConn.Open();
MessageBox.Show("打开数据库成功");
}
catch (Exception MyDbConnEx)
{
MessageBox.Show("打开数据库连接错误:" + MyDbConnEx.Message);
}
sql = "select * from color";
//sql = richTextBox1.Text;
&nbs