c#向表中插入问题!

来源:百度知道 编辑:UC知道 时间:2024/05/29 19:30:47
这个程为什么填补进去? 急求!!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsApplicationyy
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
yu yang = new yu();
yang.d();
yang.a(textBox1 .Text ,textBox2 .Text ,textBox3 .Text );
yang.e();
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";

}
}
public class yu
{
public void a(string u, string t, string f)
{
S

这是什么程序呀,乱七八糟的,帮你改一下,不喜欢别骂

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsApplicationyy
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
//插入函数
insert(textBox1.Text, textBox2.Text, textBox3.Text);
mymsg("插入成功!");
}
catch
{
mymsg("插入失败!");
}

textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";

}
private void insert(string id, string name, string phone)
{
SqlConnection conn = new SqlConnection("user id=sa;password=123;initial catalog=yysjk;data sou