易截截图软件、单文件、免安装、纯绿色、仅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# 注册控件-在运行输 ......

SQL Server 2005 CTE的用法

if object_id('[tb]') is not null
drop table [tb] 
go
create table [tb]([id] int,[col1] varchar(8),[col2] int) 
insert [tb] 
select 1,'河北省',0 union all
 select 2,'邢台市',1 union all
 select 3,'石家庄市',1 union all
 select 4,'张家口市',1 union all
&n ......

c#中的Ajax上手篇---非同步请求responseXML

我们可以使用XML作为数据传送、沟通的格式,Ajax客户端若要发送XML,基本上就是将XML作为字符串,在POST请求时发送,例如:
*HelloAjax.js
view plaincopy to clipboardprint?
var xmlHttp;  
function createXMLHttpRequest() {  
    if (window.XMLHttpRequest) {   ......

sql语句的执行顺序实例讲解


标准顺序的 SQL 语句为: 
Select 考生姓名, max(总成绩) as max总成绩 
from tb_Grade 
where 考生姓名 is not null 
group by 考生姓名 
having max(总成绩) > 600 
order by max总成绩 
在上面的示例中 SQL 语句的执行顺序如下: 
(1). 首先执行 from 子句, 从 tb_G ......

SQL中ON和WHERE条件的区别

数据库在通过连接两张或多张表来返回记录时,都会生成一张中间的临时表,然后再将这张临时表返回给用户。
在使用left jion时,on和where条件的区别如下:
1、on条件是在生成临时表时使用的条件,它不管on中的条件是否为真,都会返回左边表中的记录。
2、where条件是在临时表生成好后,再对临时表进行过滤的条件。这时已 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号