NetQuickJamesFrame/DBHelp/SqlServer.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
namespace NetQuickJamesFrame.DBHelp
{
public class SqlServer
{
private string connectionString = "server={server},{port};user id={username};pwd={password};database={dbName}";
private string server;
private int port;
private string userId;
private string pwd;
private string dbName;
public SqlServer(string server, string userId, string pwd, string dbName)
{
init(server, 3433, userId, pwd, dbName);
}
public SqlServer(string server, int port, string userId, string pwd, string dbName)
{
init(server, port, userId, pwd, dbName);
}
private void init(string server, int port, string userId, string pwd, string dbName)
{
this.server = server;
this.port = port;
this.userId = userId;
this.pwd = pwd;
this.dbName = dbName;
connectionString = "server=" + server + "," + port + ";user id=" + userId + ";pwd=" + pwd + ";database=" + dbName;
}
public int executeNonQuery(string sqlsentence)
{
int result = -1;
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
conn.Open();
string sql = sqlsentence;
SqlCommand cmd = new SqlCommand(sql, conn);
result = cmd.ExecuteNonQuery();
conn.Close();
}
catch (Exception ex)
{
conn.Close();
后面还有 68 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
