C# WinForms

来源:百度知道 编辑:UC知道 时间:2024/05/12 18:42:31
谁做过C#写的WinForms程序,有增,删,改,查几个功能就OK

花了几分钟写的,没有进行代码优化,不过你说的功能都实现了。`
请先在数据库中添加一个名字为test的数据库,一个test的表
表中的字段为:id,name,address
数据库的用户名为sa,密码为sa
Form1.cs的代码:

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 WindowsApplication4
{

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void 数据增删改查_Load(object sender, EventArgs e)
{
//this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullColumnSelect;
//this.textBox1.Text = "Provider=SQLOLEDB.1;Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=test;Data Source=.";
this.textBox1.Text = "Server=.;pwd=sa;uid=