c#使用sqlConnection 的格式

来源:百度知道 编辑:UC知道 时间:2024/05/24 10:41:39
如上 就是SqlConnection后面那一窜string的格式 谢谢
id password database之间的顺序有讲究吗

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 proc
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
try
{
DBHelper.connection.Open();
string sql = "proc_del";
SqlCommand command = new SqlCommand(sql, DBHelper.connection);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new SqlParameter("@name", SqlDbType.Char));
command.Parameters["@name"].Value = "张三";
command.Paramet