存储过程:
CREATE PROCEDURE [insert_pinglun]
(@qyid [int],
@content [ntext],
@plname [nvarchar](50),
@qq [char](20),
@email [nvarchar](50),
@ip [char](20),
@time1 [datetime])
AS INSERT INTO [cne71].[dbo].[pinglun]
( [qyid],
[content],
[plname],
[qq],
[email],
[ip],
[time1])
VALUES
( @qyid,
@content,
@plname,
@qq,
@email,
@ip,
@time1)
return 1
GO
数据层代码:(调用存储过程)
public int insertpinglun(qiyeVAO qiyeVO)
{
int rowsAffected;
int returnValue;
SqlParameter[] Parameters={
new SqlParameter("@qyid",SqlDbType.Int,6),
new SqlParameter("@content",SqlDbType.NText),
new SqlParameter("@plname",SqlDbType.NVarChar,50),
new SqlParameter("@qq",SqlDbType.Char,20),
new SqlParameter("@email",SqlDbType.NVarChar,50),
new SqlParameter("@ip",SqlDbType.Char,20),
new SqlParameter("@time1",SqlDbType.DateTime)
};
Parameters[0].Value=qiyeVO.Id;
Parameters[1].Value=qiyeVO.Content;
Parameters[2].Value=qiyeVO.Plname;
Parameters[3].Value=qiyeVO.Qq;
Parameters[4].Value=qiyeVO.Email;
Parameters[5].Value=qiyeVO.Ip;
Parameters[6].Value=qiyeVO.Time1;
core.DbObject db1= new DbObject();
returnValue = (int)db1.RunProcedure("insert_pinglun",Parameters,out rowsAffected);
return returnValue;
}
类代码:(core/DbObject .cs)
public class DbObject
{
protected SqlConnection Connection;
private string connectionString;
public DbObject()
{
connectionString = System.Configuration.ConfigurationSettings.AppSettings["sqlConnection"];
Connection = new SqlConnection( connectionString );
}
public SqlCommand BuildIntCommand(string storedProcName,IDataParameter[] parameters)
{
SqlCommand command = BuildQueryCommand ( storedProcName,parameters );
command.Parameters.Add(new SqlParameter("ReturnValue",SqlDbType.Int,4,ParameterDirection.ReturnValue,false,0,0,string.Empty,DataRowVersion.Default,null));
return command;
}
public SqlCommand BuildQueryCommand ( string storedProcName,IDataParameter[] parameters)
{
SqlCommand command = new SqlCommand( storedProcName,Connection);
command.CommandType = CommandType.StoredProcedure;
foreach ( SqlParameter parameter in parameters )
{
command.Parameters.Add( parameter );
//System.Web.HttpContext.Current.Response.Write( parameter.ParameterName);
//System.Web.HttpContext.Current.Response.Write( parameter.SqlDbType);
//System.Web.HttpContext.Current.Response.Write( parameter.Value);
}
//System.Web.HttpContext.Current.Response.Write (command.Parameters.Count);
return command;
}
protected string ConnectionString
{
get
{
return connectionString;
}
}
public int RunProcedure ( string storedProcName ,IDataParameter[] parameters, out int rowsAffected )
{
int result;
Connection.Open();
SqlCommand command = BuildIntCommand ( storedProcName ,parameters );
rowsAffected = command.ExecuteNonQuery();//没有影响就是-1
result = (int)command.Parameters["ReturnValue"].Value;
Connection.Close();
Connection.Dispose();
return result;
}
}
=================================================
DropDownList--ListBox--CheckBoxList--RadioButtonList:ListItem
向ListBox中添加条目
ListBox1.Items.Add(new ListItem("Olivne","MG2SIO4"));
输出ListBox中多个选中项
===
.aspx
===
<asp:ListBox ID="ListBox1" runat="server" SelectionMode="Multiple">
<asp:ListItem>Hematite</asp:ListItem>
<asp:ListItem>Halite</asp:ListItem>
<asp:ListItem>Limonite</asp:ListItem>
<asp:ListItem>Magnetite</asp:ListItem>
</asp:ListBox>
===
.cs
===
Label3.Text="You selected from ListBox:<br>";
foreach (ListItem li in ListBox1.Items)
{
if (li.Selected == true)
{
Label3.Text += li.Text + "</br>";
}
}
确定复选框是否被选中
if(CheckBox1.checked==true){}
给复选框赋值
CheckBox1.checked=true;
分享到:
相关推荐
arcgis api for javascript v4.16 v3.33, 包含了3和4两个版本的 api,欢迎大家下载
linux-4.16.10.tar.xz kernel 内核 可编译
Odin Multi Downloader v4.16
计算机组成与性能设计 4.16
linux-4.16.8.tar.gz 内核源码 kernel 编译内核用
sip-4.16.6 软件,需要的下载~
linux-4.16.12.tar linux-4.16内核源码。Linux是一种开源电脑操作系统内核。它是一个用C语言写成,符合POSIX标准的类Unix操作系统。 [1] Linux最早是由芬兰 Linus Torvalds为尝试在英特尔x86架构上提供自由的类Unix...
spring4.16版本全部的包,官网来的,下载并使用
ubuntu 4.16内核升级包,解决无线网卡和各种兼容问题,安装方法及无线网卡解决方式见我的博客https://blog.csdn.net/qq_28901541/article/details/86242029
MX Component 4.16S最新软件(2018/11/5),三菱PLC官方上位机通讯中间件 ,C#,vb.net,c++.net和三菱PLC通讯时,可以调用该软件DLL和PLC通讯,使用非常方便。地址为百度网盘下载链接
4.16MySchoolApplicion4.16MySchoolApplicion4.16MySchoolApplicion4.16MySchoolApplicion4.16MySchoolApplicion4.16MySchoolApplicion4.16MySchoolApplicion4.16MySchoolApplicion4.16MySchoolApplicion
vs2012连接 sqlite 试用版 4.16版本
三菱MX-Component4.16S安装包链接,支持win7,win8;语言VB,C++,C#;三菱MX-Component4.16S安装包链接;三菱MX-Component4.16S安装包链接;
最新版windows eclipse-SDK-4.16-win32-x86_64.zip
avrstudio4.16的汉化包,下载解压缩之后替换原有文件即可,非常方便
CPS4.16
C++并发编程实战代码
tampermonkey-4.16.6160-an+fx.xpi
如题,Drive Fitness Test v4.16 绿色硬盘版,直接解压缩到 C 盘,重启电脑即可使用。 制作这个版本的原因是:官网上下载的 DFT 需要软驱或者光驱才能使用,不是很方便。 Drive Fitness Test v4.16 绿色硬盘版 ...
最新 三菱PLC通讯软件 MX Component 4.16S 兼容所有三菱PLC, C# 与 三菱PLC通讯软件,文件大小400M,内涵下载连接及提取码