怎样用C#创建一个与数据库相连的修改密码的
展开全部
自己已经测试过
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 KtvMng
{
public partial class UpdPwd : Form
{
SqlConnection conn;
SqlCommand comm;
string userid = "";
public UpdPwd(string UserId)
{
InitializeComponent();
userid = UserId;
}
private void btnUpd_Click(object sender, EventArgs e)
{
//连接数据库
conn = new SqlConnection("server=localhost;database=test;Integrated Security=true");
try
{
conn.Open();
}
catch
{
MessageBox.Show("连接数据库失败!");
}
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 KtvMng
{
public partial class UpdPwd : Form
{
SqlConnection conn;
SqlCommand comm;
string userid = "";
public UpdPwd(string UserId)
{
InitializeComponent();
userid = UserId;
}
private void btnUpd_Click(object sender, EventArgs e)
{
//连接数据库
conn = new SqlConnection("server=localhost;database=test;Integrated Security=true");
try
{
conn.Open();
}
catch
{
MessageBox.Show("连接数据库失败!");
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询