易截截图软件、单文件、免安装、纯绿色、仅160KB

C#操作各种执行sql的方法含存储过程操作

using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Xml;
using System.Data;
namespace MyDbTest
{
class Program
{
static void Main(string[] args)
{
SqlConnection thisConnection = new SqlConnection(
@"Data Source=localhost;Initial Catalog=CSGL;Persist Security Info=True;User ID=test;Password=test");
thisConnection.Open();
SqlCommand myCommand = new SqlCommand("P_Test", thisConnection);
myCommand.CommandType = CommandType.StoredProcedure;
//添加输入查询参数、赋予值
myCommand.Parameters.Add("@id", SqlDbType.Int);
myCommand.Parameters["@id"].Value = "120";
//添加输出参数
myCommand.Parameters.Add("@Rowcount", SqlDbType.Int);
myCommand.Parameters["@Rowcount"].Direction = ParameterDirection.Output;
myCommand.ExecuteNonQuery();
//得到存储过程输出参数
Console.WriteLine(" 存储过程的参数"+ myCommand.Parameters["@Rowcount"].Value.ToString());
thisConnection.Close();
Console.ReadLine();

//SqlCommand thisCommand = thisConnection.CreateCommand();
//thisCommand.CommandText = "select count(*) from stu";
////ExecuteScalar:执行只返回一个值的SQL命令。
//object countResult = thisCommand.ExecuteScalar();
//Console.WriteLine("Count of Customers={0}", countResult);
//thisConnection.Close();
//Console.ReadLine();

//SqlCommand thisCommand = thisConnection.CreateCommand();
//thisCommand.CommandText = "update stu set snm='haha' where id=120";
////Inset,Update,Delelte的数据修改操作也不返回任何数据,
////我们对这些命令感兴趣的是修改操作影响的行数,可以用ExecuteNonQuery()方法
//int rowsAffected = thisCommand.ExecuteNonQuery();
//Console.WriteLine("Rows Updated={0}", rowsAffected);
//thisConnection.


相关文档:

C#与Flash交互

C#与Flash交互 (转自小磊在线)
C#与Flash交互
前段日子公司要求做一个C#与Flash交互的东西,用来C#与短信猫通讯将数据传到Flash上显示与操作的应用。
第一步C#添加组件
打开VS2005-工具-选择工具箱项-COM组件-选择Shockwave Flash Object-确定
添加好组件往场景上拖放,如果提示注册需求注册
c# 注册控件-在运行输 ......

JavaScript中访问C#变量及方法

1.如何在javascript访问C#变量
方法一:使用<%=%>
 <input id="Button3" type="button" value="js调用c#变量" onclick="return Button3_onclick()" />
function Button3_onclick()
{        
    alert('我的名字:'+ '<%=name %>'); ......

SQL Server数据库管理常用SQL和T SQL语句

1.查看数据库的版本
select @@version
2.查看数据库所在机器操作系统参数
exec master..xp_msver
3.查看数据库启动的参数
sp_configure
4.查看数据库启动时间
select convert(varchar(30),login_time,120) from master..sysprocesses where spid=1
查看数据库服务器名和实例名
print ''Server Name...... ......

如何让你的SQL运行得更快


  ----   人们在使用SQL时往往会陷入一个误区,即太关注于所得的结果是否正确,而忽略  
  了不同的实现方法之间可能存在的性能差异,这种性能差异在大型的或是复杂的数据库  
  环境中(如联机事务处理OLTP或决策支持系统DSS)中表现得尤为明显。笔者在工作实践  
  中发 ......

sql之left join、right join、inner join的区别


 
sql之left join、right join、inner join的区别
昨天面试8页笔试题目,基本上都是SQl 的,特别是这几个区别,记得不是很清晰,只记得left是以左表为主表,
right以右表为主表,导致做错了几个!今天搜了下!总算弄清楚了!以下是转帖!
left join(左联接) 返回包括左表中的所有记录和右表中联结字段相等的记录
right j ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号