社区
C#
帖子详情
求c/s模式下 C#编程数据链接类 :用微软的sqlhelper类编写的
billlyh
2005-07-14 05:18:18
用微软的sqlhelper类编写的,通过此类对数据库增删改,发到论坛或我邮箱billlyh@163.com
100分回送!!!!!!!!!!!!1
...全文
145
1
打赏
收藏
求c/s模式下 C#编程数据链接类 :用微软的sqlhelper类编写的
用微软的sqlhelper类编写的,通过此类对数据库增删改,发到论坛或我邮箱billlyh@163.com 100分回送!!!!!!!!!!!!1
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
1 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
thinkingforever
2005-07-14
打赏
举报
回复
public void update_AQ_SafetyEvaluate(DataSet ds)
{
this.sqlConnection = new System.Data.SqlClient.SqlConnection();
this.sqlConnection.ConnectionString=strConn;
this.sqlConnection.Open();
this.sqlInsertCommand = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand = new System.Data.SqlClient.SqlCommand();
this.sqlDeleteCommand = new System.Data.SqlClient.SqlCommand();
try
{
//
// sqlInsertCommand
//
this.sqlInsertCommand.CommandText = @"INSERT INTO AQ_SafetyEvaluate(Date, ConstructLoc, MorSafetyValue, MinSafetyValue, NiSafetyValue, ExistProblem, DepNo) VALUES (@Date, @ConstructLoc, @MorSafetyValue, @MinSafetyValue, @NiSafetyValue, @ExistProblem, @DepNo)";
this.sqlInsertCommand.Connection = this.sqlConnection;
this.sqlInsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Date", System.Data.SqlDbType.DateTime, 8, "Date"));
this.sqlInsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ConstructLoc", System.Data.SqlDbType.VarChar, 100, "ConstructLoc"));
this.sqlInsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@MorSafetyValue", System.Data.SqlDbType.Float, 8, "MorSafetyValue"));
this.sqlInsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@MinSafetyValue", System.Data.SqlDbType.Float, 8, "MinSafetyValue"));
this.sqlInsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@NiSafetyValue", System.Data.SqlDbType.Float, 8, "NiSafetyValue"));
this.sqlInsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ExistProblem", System.Data.SqlDbType.VarChar, 100, "ExistProblem"));
this.sqlInsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@DepNo", System.Data.SqlDbType.VarChar, 10, "DepNo"));
//
// sqlUpdateCommand
//
this.sqlUpdateCommand.CommandText = @"UPDATE AQ_SafetyEvaluate SET Date = @Date, ConstructLoc = @ConstructLoc, MorSafetyValue = @MorSafetyValue, MinSafetyValue = @MinSafetyValue, NiSafetyValue = @NiSafetyValue, ExistProblem = @ExistProblem, DepNo = @DepNo WHERE (ID = @Original_ID)";
this.sqlUpdateCommand.Connection = this.sqlConnection;
this.sqlUpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Date", System.Data.SqlDbType.DateTime, 8, "Date"));
this.sqlUpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ConstructLoc", System.Data.SqlDbType.VarChar, 100, "ConstructLoc"));
this.sqlUpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@MorSafetyValue", System.Data.SqlDbType.Float, 8, "MorSafetyValue"));
this.sqlUpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@MinSafetyValue", System.Data.SqlDbType.Float, 8, "MinSafetyValue"));
this.sqlUpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@NiSafetyValue", System.Data.SqlDbType.Float, 8, "NiSafetyValue"));
this.sqlUpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ExistProblem", System.Data.SqlDbType.VarChar, 100, "ExistProblem"));
this.sqlUpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@DepNo", System.Data.SqlDbType.VarChar, 10, "DepNo"));
this.sqlUpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ID", System.Data.DataRowVersion.Original, null));
//
// sqlDeleteCommand
//
this.sqlDeleteCommand.CommandText = @"DELETE FROM AQ_SafetyEvaluate WHERE (ID = @Original_ID)";
this.sqlDeleteCommand.Connection = this.sqlConnection;
this.sqlDeleteCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ID", System.Data.DataRowVersion.Original, null));
SqlHelper.UpdateDataset(this.sqlInsertCommand,this.sqlDeleteCommand,this.sqlUpdateCommand,ds,ds.Tables[0].TableName);
}
catch(Exception ex)
{
finally
{
this.sqlConnection.Close();
}
}
c#
,VB
SQL
Helper
数据
库
类
SQL
Helper
是
微软
在早期.NET开发中推荐的
数据
访问
模式
,尤其适用于简单的
数据
操作场景。这个
类
库通常包含在System.Data.
Sql
Client命名空间下,用于简化
SQL
Server的CRUD(创建、读取、更新、删除)操作。 标题"**
C#
...
使用
Sql
Helper
增加
数据
库记录
编程
小实例,C++.net源代码
编写
这个
编程
小实例主要展示了如何使用C++ .NET来实现
Sql
Helper
,从而便捷地向
数据
库添加新记录。下面我们将深入探讨这个话题。 首先,我们需要理解
Sql
Helper
的作用。在
C#
.NET中,
Sql
Helper
通常是一个静态
类
,它封装了...
C#
SQL
SERVER
数据
库操作
类
标题“
C#
SQL
SERVER
数据
库操作
类
”表明本内容主要介绍的是在
C#
环境下进行
SQL
SERVER
数据
库操作的
类
的设计和实现。从描述“
C#
实现
SQL
SERVER
数据
库操作
类
,很方便的使用的”我们可以得知,本文所介绍的
类
是经过封装...
SQL
Helper
.dll
在VB.NET环境下,
SQL
Helper
的使用方式与
C#
类
似,只是语法有所差异。开发者可以通过创建
SQL
Helper
类
的实例,然后调用其方法来执行
SQL
命令。这使得VB.NET开发者也能享受到同样简便的
数据
库操作体验。
SQL
Helper
还支持...
C#
基
类
整理
6. **字符串加密**:在
C#
中,可以使用System.Security.Cryptography命名空间下的
类
进行字符串加密。例如,AES(高级加密标准)、RSA(公钥加密算法)和SHA(安全散列算法)等,这些加密算法可用于保护敏感信息的安全...
C#
111,093
社区成员
642,554
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章