62,266
社区成员
发帖
与我相关
我的任务
分享public DataRow personinformation(string uid)
{
string constring = @"Data Source=(local)\SQLEXPRESS;Initial Catalog=aspnetdb;User ID=sa;Password=123456;";
SqlConnection con = new SqlConnection(constring);
con.Open();
//创建SqlDataAdapter对象,并调用userinformation存储过程
SqlDataAdapter sda = new SqlDataAdapter("userinformation", con);
//设定sda对象要执行命令的类型
sda.SelectCommand.CommandType = CommandType.StoredProcedure;
//添加参数并设定参数的值
sda.SelectCommand.Parameters.Add("@uid", SqlDbType.VarChar, 50).Value = uid;
//创建数据集
DataSet ds = new DataSet();
try
{
//填充数据集合
sda.Fill(ds);
//返回数据集中数据行
return ds.Tables[0].Rows[0];
}
catch (Exception error)
{
throw new System.Exception(error.Message);
}
finally
{
con.Close();
}
}
SqlCommand command = new SqlCommand("userinformation", con);
command.CommandType=CommandType.StoredProcedure;
SqlDataAdapter SqlDataAdapter = new SqlDataAdapter(command); USE [ZA]
GO
/****** 对象: StoredProcedure [dbo].[SelectVisitors] 脚本日期: 01/06/2010 10:56:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SelectVisitors]
AS
SET NOCOUNT ON;
SELECT ID, LevelMarkID, logonLevelID, segmentID, timeID, newVisits, returnVisits, Visitors, newPageViews, returnPageViews, newTimeOnSite, returnTimeOnSite, newBounces, returnBounces FROM dbo.visitors