C#的时间正则表达式
[
2008/06/26 11:40 | by Else ]
2008/06/26 11:40 | by Else ]
[codes=C#]
///
public string timeformat(string timestr)
{
timestr = timestr.Trim();
if (Regex.IsMatch(timestr, @"^(\d{4})\D*(\d{2})\D*(\d{2})$"))
{
//this.Nodate = true;
return Regex.Replace(timestr, @"^(\d{4})\D*(\d{2})\D*(\d{2})$", "$1-$2-$3", RegexOptions.None);
}
else
{
// this.Nodate = false;
return timestr;
}
}[/codes]
///
public string timeformat(string timestr)
{
timestr = timestr.Trim();
if (Regex.IsMatch(timestr, @"^(\d{4})\D*(\d{2})\D*(\d{2})$"))
{
//this.Nodate = true;
return Regex.Replace(timestr, @"^(\d{4})\D*(\d{2})\D*(\d{2})$", "$1-$2-$3", RegexOptions.None);
}
else
{
// this.Nodate = false;
return timestr;
}
}[/codes]
Excel to DataGridView using excel 2007
[
2008/06/20 17:14 | by Else ]
2008/06/20 17:14 | by Else ]
object oMissing = Missing.Value;
Microsoft.Office.Interop.Excel.Application ExcelObj =
new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook WBook;
Microsoft.Office.Interop.Excel.Worksheet WSheet;
Microsoft.Office.Interop.Excel.Range Selection;
WBook = ExcelObj.Workbooks.Open(@"c:\test\1.xlsx",
oMissing, oMissing, oMissing, oMissing, oMissing,
oMissing, oMissing, oMissing, oMissing, oMissing,
oMissing, oMissing, oMissing, oMissing);
OleDbType 枚举
[
2008/05/26 14:32 | by Else ]
2008/05/26 14:32 | by Else ]
C#的商品分类,商品修 改删除
[
2008/05/21 18:08 | by Else ]
2008/05/21 18:08 | by Else ]
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="utf-8"%>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
<MM:Insert
runat="server"
CommandText='<%# "INSERT INTO dbo.cuku_cat (catname, catlist, catcont) VALUES (?, ?, ?)" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
Expression='<%# Request.Form["MM_insert"] == "form2" && Request.Form["id"]=="" && Request.Form["catname"]!="" %>'
CreateDataSet="false"
SuccessURL='<%# "adminproducts.aspx?act=class" %>'
FailureURL='<%# "adminproducts.aspx?act=class" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@catname" Value='<%# ((Request.Form["catname"] != null) && (Request.Form["catname"].Length > 0)) ? Request.Form["catname"] : "" %>' Type="VarChar" />
<Parameter Name="@catlist" Value='<%# ((Request.Form["catlist"] != null) && (Request.Form["catlist"].Length > 0)) ? Request.Form["catlist"] : "" %>' Type="Integer" />
<Parameter Name="@catcont" Value='<%# ((Request.Form["catcont"] != null) && (Request.Form["catcont"].Length > 0)) ? Request.Form["catcont"] : "" %>' Type="VarChar" />
</Parameters>
</MM:Insert>
<MM:Update
runat="server"
CommandText='<%# "UPDATE dbo.cuku_cat SET catcont=?, catlist=?, catname=? WHERE id=?" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
Expression='<%# Request.Form["MM_update"] == "form2" && Request.Form["id"]!="" %>'
CreateDataSet="false"
SuccessURL='<%# "adminproducts.aspx?act=class" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@catcont" Value='<%# ((Request.Form["catcont"] != null) && (Request.Form["catcont"].Length > 0)) ? Request.Form["catcont"] : "" %>' Type="VarChar" />
<Parameter Name="@catlist" Value='<%# ((Request.Form["catlist"] != null) && (Request.Form["catlist"].Length > 0)) ? Request.Form["catlist"] : "" %>' Type="Integer" />
<Parameter Name="@catname" Value='<%# ((Request.Form["catname"] != null) && (Request.Form["catname"].Length > 0)) ? Request.Form["catname"] : "" %>' Type="VarChar" />
<Parameter Name="@id" Value='<%# ((Request.Form["id"] != null) && (Request.Form["id"].Length > 0)) ? Request.Form["id"] : "" %>' Type="Integer" />
</Parameters>
</MM:Update>
<MM:Delete
runat="server"
CommandText='<%# "DELETE FROM dbo.cuku_cat WHERE id=?" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
Expression='<%# ((Request.QueryString["act"] == "del") && (Request.QueryString["do"]=="class")) %>'
CreateDataSet="false"
SuccessURL='<%# "adminproducts.aspx?act=class" %>'
FailureURL='<%# "adminproducts.aspx?act=class" %>'
Debug="true"
><Parameters>
<Parameter Name="@id" Value='<%# ((Request.QueryString["id"] != null) && (Request.QueryString["id"].Length > 0)) ? Request.QueryString["id"] : "" %>' Type="Integer" />
</Parameters>
</MM:Delete>
<!--插入产品-->
<MM:Insert
runat="server"
CommandText='<%# "INSERT INTO dbo.cuku_products (prodoucts, catid, content, recom, uptop, isnew, cont, pic) VALUES (?, ?, ?, ?, ?, ?, ?, ?)" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
Expression='<%# Request.Form["MM_insert"] == "form1" && Request.Form["id"].Trim()=="" %>'
CreateDataSet="false"
SuccessURL='<%# "adminproducts.aspx" %>'
FailureURL='<%# "adminproducts.aspx?act=add" %>'
Debug="true"
><Parameters>
<Parameter Name="@prodoucts" Value='<%# ((Request.Form["prodoucts"] != null) && (Request.Form["prodoucts"].Length > 0)) ? Request.Form["prodoucts"] : "" %>' Type="VarChar" />
<Parameter Name="@catid" Value='<%# ((Request.Form["catid"] != null) && (Request.Form["catid"].Length > 0)) ? Request.Form["catid"] : "" %>' Type="Integer" />
<Parameter Name="@content" Value='<%# ((Request.Form["content"] != null) && (Request.Form["content"].Length > 0)) ? Request.Form["content"] : "" %>' Type="VarChar" />
<Parameter Name="@recom" Value='<%# ((Request.Form["recom"] != null) && (Request.Form["recom"].Length > 0)) ? Request.Form["recom"] : "" %>' Type="Boolean" />
<Parameter Name="@uptop" Value='<%# ((Request.Form["uptop"] != null) && (Request.Form["uptop"].Length > 0)) ? Request.Form["uptop"] : "" %>' Type="Boolean" />
<Parameter Name="@isnew" Value='<%# ((Request.Form["isnew"] != null) && (Request.Form["isnew"].Length > 0)) ? Request.Form["isnew"] : "" %>' Type="Boolean" />
<Parameter Name="@cont" Value='<%# ((Request.Form["cont"] != null) && (Request.Form["cont"].Length > 0)) ? Request.Form["cont"] : "" %>' Type="VarChar" />
<Parameter Name="@pic" Value='<%# ((Request.Form["pic"] != null) && (Request.Form["pic"].Length > 0)) ? Request.Form["pic"] : "" %>' Type="VarChar" />
</Parameters>
</MM:Insert>
<MM:Update
runat="server"
CommandText='<%# "UPDATE dbo.cuku_products SET cont=?, content=?, isnew=?, recom=?, catid=?, pic=?, prodoucts=?, uptop=? WHERE id=?" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
Expression='<%# Request.Form["MM_update"] == "form1" && Request.Form["id"].Trim()!="" %>'
CreateDataSet="false"
SuccessURL='<%# "adminproducts.aspx" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@cont" Value='<%# ((Request.Form["cont"] != null) && (Request.Form["cont"].Length > 0)) ? Request.Form["cont"] : "" %>' Type="VarChar" />
<Parameter Name="@content" Value='<%# ((Request.Form["content"] != null) && (Request.Form["content"].Length > 0)) ? Request.Form["content"] : "" %>' Type="VarChar" />
<Parameter Name="@isnew" Value='<%# ((Request.Form["isnew"] != null) && (Request.Form["isnew"].Length > 0)) ? Request.Form["isnew"] : "" %>' Type="Boolean" />
<Parameter Name="@recom" Value='<%# ((Request.Form["recom"] != null) && (Request.Form["recom"].Length > 0)) ? Request.Form["recom"] : "" %>' Type="Boolean" />
<Parameter Name="@catid" Value='<%# ((Request.Form["catid"] != null) && (Request.Form["catid"].Length > 0)) ? Request.Form["catid"] : "" %>' Type="Integer" />
<Parameter Name="@pic" Value='<%# ((Request.Form["pic"] != null) && (Request.Form["pic"].Length > 0)) ? Request.Form["pic"] : "" %>' Type="VarChar" />
<Parameter Name="@prodoucts" Value='<%# ((Request.Form["prodoucts"] != null) && (Request.Form["prodoucts"].Length > 0)) ? Request.Form["prodoucts"] : "" %>' Type="VarChar" />
<Parameter Name="@uptop" Value='<%# ((Request.Form["uptop"] != null) && (Request.Form["uptop"].Length > 0)) ? Request.Form["uptop"] : "" %>' Type="Boolean" />
<Parameter Name="@id" Value='<%# ((Request.Form["id"] != null) && (Request.Form["id"].Length > 0)) ? Request.Form["id"] : "" %>' Type="Integer" />
</Parameters>
</MM:Update>
<MM:DataSet
id="rs"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
CommandText='<%# "SELECT * FROM dbo.cuku_cat ORDER BY id DESC" %>'
Debug="true"
></MM:DataSet>
<MM:DataSet
id="editrs"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
CommandText='<%# "SELECT * FROM dbo.cuku_cat WHERE id = ?" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@id" Value='<%# ((Request.QueryString["id"] != null) && (Request.QueryString["id"].Length > 0)) ? Request.QueryString["id"] : "" %>' Type="Integer" />
</Parameters>
</MM:DataSet>
<MM:DataSet
id="pds"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
CommandText='<%# "SELECT * FROM dbo.cuku_products,dbo.cuku_cat WHERE dbo.cuku_cat.id = dbo.cuku_products.catid ORDER BY dbo.cuku_products.id desc" %>'
CurrentPage='<%# ((Request.QueryString["pds_CurrentPage"] != null) && (Request.QueryString["pds_CurrentPage"].Length > 0)) ? Int32.Parse(Request.QueryString["pds_CurrentPage"]) : 0 %>'
PageSize="20"
Debug="true"
></MM:DataSet>
<MM:DataSet
id="editpds"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
CommandText='<%# "SELECT * FROM dbo.cuku_products WHERE id = ?" %>'
Expression='<%# Myac=="add" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@id" Value='<%# ((Request.QueryString["id"] != null) && (Request.QueryString["id"].Length > 0)) ? Request.QueryString["id"] : "" %>' Type="Integer" /> </Parameters>
</MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>产品管理</title>
<link href="images/admin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script>
function del(ids,what)
{
if(confirm("你确定要删除吗?")){
window.location.href="?act=del&do="+what+"&id="+ids;
}else{
return
}
}
</script>
<script runat="server">
private string myac;
public string Myac
{
get { return this.myac; }
set { this.myac = value; }
}
public string Checked(string chkstr)
{
return chkstr=="True" ? "checked=\"checked\"":"";
}
public void Page_Load(Object Src, EventArgs E)
{
if (Request.QueryString["act"]== null)
{
Myac="go";
}
else
{
Myac=Request.QueryString["act"].Trim();
}
}
</script>
<mm:if runat="server" expression='<%# Myac=="go" %>'>
<contentstemplate>
<table width="600" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td height="25" colspan="5" background="images/bg_lead.png"> 产品管理</td>
</tr>
<tr>
<td width="6%" align="center" bgcolor="#CCEAFA">编号</td>
<td width="25%" align="center" bgcolor="#CCEAFA">产品名称</td>
<td width="23%" align="center" bgcolor="#CCEAFA">分类</td>
<td width="23%" align="center" bgcolor="#CCEAFA">属性</td>
<td width="23%" align="center" bgcolor="#CCEAFA">管理</td>
</tr>
<ASP:Repeater runat="server" DataSource='<%# pds.DefaultView %>'>
<ItemTemplate>
<tr>
<td height="21" align="center" bgcolor="#CCEAFA"><%# pds.FieldValue("id", Container) %></td>
<td bgcolor="#CCEAFA"><%# pds.FieldValue("prodoucts", Container) %></td>
<td bgcolor="#CCEAFA"><%# pds.FieldValue("catname", Container) %></td>
<td bgcolor="#CCEAFA"><%# pds.FieldValue("isnew", Container) %><%# pds.FieldValue("recom", Container) %><%# pds.FieldValue("isnew", Container) %></td>
<td align="center" bgcolor="#CCEAFA"><a href="?act=add&id=<%# pds.FieldValue("id", Container) %>">修改</a> <a href="javascript:del('<%# pds.FieldValue("id", Container) %>','pro')">删除</a></td>
</tr>
</ItemTemplate>
</ASP:Repeater>
<tr>
<td colspan="5" align="center" bgcolor="#CCEAFA">首页 上一页 下一页 末页</td>
</tr>
</table>
</contentstemplate>
</mm:if>
<mm:if runat="server" expression='<%# Myac=="add" %>' >
<contentstemplate>
<form action="" method='POST' enctype="multipart/form-data" name='form1' id="form1" runat='server'>
<table width="600" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td height="27" colspan="2" background="images/bg_lead.png" bgcolor="#EFF9FE"> 修改/添加商品</td>
</tr>
<tr>
<td width="121" height="23" align="center" bgcolor="#CCEAFA">产品名称</td>
<td width="479" bgcolor="#CCEAFA"><label>
<input name="prodoucts" type="text" id="prodoucts" value="<%# editpds.FieldValue("prodoucts", Container) %>" />
<input name="id" type="hidden" id="id" value="<%# editpds.FieldValue("id", Container) %>" />
</label></td>
</tr>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA">产品分类</td>
<td bgcolor="#CCEAFA">
<select name="catid" id="catid">
<ASP:Repeater runat="server" DataSource='<%# rs.DefaultView %>'>
<ItemTemplate>
<option value="<%# rs.FieldValue("id", Container) %>"><%# rs.FieldValue("catname", Container) %></option>
</ItemTemplate>
</ASP:Repeater>
</select>
</td>
</tr>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA">商品图片</td>
<td bgcolor="#CCEAFA"><label>
<input name="pic" type="text" id="pic" value="<%# editpds.FieldValue("pic", Container) %>" />
</label></td>
</tr>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA">上传图片</td>
<td bgcolor="#CCEAFA"><label>
<input type="file" name="fileField" id="fileField" />
</label></td>
</tr>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA">说 明</td>
<td bgcolor="#CCEAFA"><input name="cont" type="text" id="cont" value="<%# editpds.FieldValue("cont", Container) %>" /></td>
</tr>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA">商品属性</td>
<td bgcolor="#CCEAFA"><label>
<input name="isnew" type="checkbox" id="isnew" value="true" <%# Checked(editpds.FieldValue("isnew", Container))%> />
新商品
<input name="recom" type="checkbox" id="recom" value="true" <%# Checked(editpds.FieldValue("recom", Container))%>/>
推荐
<input name="uptop" type="checkbox" id="uptop" value="true" <%# Checked(editpds.FieldValue("uptop", Container))%>/>
置顶
</label></td>
</tr>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA">介 绍</td>
<td bgcolor="#CCEAFA"><label>
<textarea name="content" id="content" cols="45" rows="5"><%# editpds.FieldValue("content", Container) %></textarea>
</label></td>
</tr>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA"> </td>
<td bgcolor="#CCEAFA"><label for="button"></label>
<input type="submit" name="button" id="button" value="提交" />
<label>
<input type="reset" name="button2" id="button2" value="重设" />
<input name="button3" type="button" id="button3" onclick="history.go(-1)" value="返回" />
</label></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
<input type="hidden" name="MM_update" value="form1" />
</form>
</contentstemplate>
</mm:if>
<mm:if runat="server" expression='<%# Myac=="class" %>' >
<contentstemplate>
<table width="387" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td height="25" colspan="5" align="center" background="images/bg_lead.png"> 分类列表</td>
</tr>
<tr>
<td width="27" height="23" align="center" bgcolor="#CCEAFA">编号</td>
<td width="79" align="center" bgcolor="#CCEAFA">分类名称</td>
<td width="30" align="center" bgcolor="#CCEAFA">顺序</td>
<td width="175" align="center" bgcolor="#CCEAFA">说明</td>
<td width="60" align="center" bgcolor="#CCEAFA">管理</td>
</tr>
<ASP:Repeater runat="server" DataSource='<%# rs.DefaultView %>'>
<ItemTemplate>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA"> <%# rs.FieldValue("id", Container) %></td>
<td align="center" bgcolor="#CCEAFA"><%# rs.FieldValue("catname", Container) %></td>
<td align="center" bgcolor="#CCEAFA"><%# rs.FieldValue("catlist", Container) %></td>
<td bgcolor="#CCEAFA"><%# rs.FieldValue("catcont", Container) %></td>
<td bgcolor="#CCEAFA"><a href="?act=class&id=<%# rs.FieldValue("id", Container) %>">修改</a> <a href="javascript:del('<%# rs.FieldValue("id", Container) %>','class');">删除</a></td>
</tr>
</ItemTemplate>
</ASP:Repeater>
</table>
<form runat='server' id="form2" name='form2' method='POST' action="">
<table width="387" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td height="25" colspan="2" background="images/bg_lead.png"> 产品分类添加</td>
</tr>
<tr>
<td width="100" align="center">分类名称</td>
<td width="272"><label>
<input name="catname" type="text" id="catname" value="<%# editrs.FieldValue("catname", Container) %>" />
<input name="id" type="hidden" id="id" value="<%# editrs.FieldValue("id", Container) %>" />
</label></td>
</tr>
<tr>
<td align="center">分类顺序</td>
<td><input name="catlist" type="text" id="catlist" value="<%# editrs.FieldValue("catlist", Container) %>" /></td>
</tr>
<tr>
<td align="center">分类说明</td>
<td><input name="catcont" type="text" id="catcont" value="<%# editrs.FieldValue("catcont", Container) %>" /></td>
</tr>
<tr>
<td align="center"> </td>
<td><label>
<input type="submit" name="button4" id="button4" value="提交" />
<input type="reset" name="button5" id="button5" value="重置" />
<input type="button" name="button6" id="button6" value="返回" />
</label></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form2" />
<input type="hidden" name="MM_update" value="form2" />
</form>
</contentstemplate>
</mm:if>
</body>
</html>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
<MM:Insert
runat="server"
CommandText='<%# "INSERT INTO dbo.cuku_cat (catname, catlist, catcont) VALUES (?, ?, ?)" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
Expression='<%# Request.Form["MM_insert"] == "form2" && Request.Form["id"]=="" && Request.Form["catname"]!="" %>'
CreateDataSet="false"
SuccessURL='<%# "adminproducts.aspx?act=class" %>'
FailureURL='<%# "adminproducts.aspx?act=class" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@catname" Value='<%# ((Request.Form["catname"] != null) && (Request.Form["catname"].Length > 0)) ? Request.Form["catname"] : "" %>' Type="VarChar" />
<Parameter Name="@catlist" Value='<%# ((Request.Form["catlist"] != null) && (Request.Form["catlist"].Length > 0)) ? Request.Form["catlist"] : "" %>' Type="Integer" />
<Parameter Name="@catcont" Value='<%# ((Request.Form["catcont"] != null) && (Request.Form["catcont"].Length > 0)) ? Request.Form["catcont"] : "" %>' Type="VarChar" />
</Parameters>
</MM:Insert>
<MM:Update
runat="server"
CommandText='<%# "UPDATE dbo.cuku_cat SET catcont=?, catlist=?, catname=? WHERE id=?" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
Expression='<%# Request.Form["MM_update"] == "form2" && Request.Form["id"]!="" %>'
CreateDataSet="false"
SuccessURL='<%# "adminproducts.aspx?act=class" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@catcont" Value='<%# ((Request.Form["catcont"] != null) && (Request.Form["catcont"].Length > 0)) ? Request.Form["catcont"] : "" %>' Type="VarChar" />
<Parameter Name="@catlist" Value='<%# ((Request.Form["catlist"] != null) && (Request.Form["catlist"].Length > 0)) ? Request.Form["catlist"] : "" %>' Type="Integer" />
<Parameter Name="@catname" Value='<%# ((Request.Form["catname"] != null) && (Request.Form["catname"].Length > 0)) ? Request.Form["catname"] : "" %>' Type="VarChar" />
<Parameter Name="@id" Value='<%# ((Request.Form["id"] != null) && (Request.Form["id"].Length > 0)) ? Request.Form["id"] : "" %>' Type="Integer" />
</Parameters>
</MM:Update>
<MM:Delete
runat="server"
CommandText='<%# "DELETE FROM dbo.cuku_cat WHERE id=?" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
Expression='<%# ((Request.QueryString["act"] == "del") && (Request.QueryString["do"]=="class")) %>'
CreateDataSet="false"
SuccessURL='<%# "adminproducts.aspx?act=class" %>'
FailureURL='<%# "adminproducts.aspx?act=class" %>'
Debug="true"
><Parameters>
<Parameter Name="@id" Value='<%# ((Request.QueryString["id"] != null) && (Request.QueryString["id"].Length > 0)) ? Request.QueryString["id"] : "" %>' Type="Integer" />
</Parameters>
</MM:Delete>
<!--插入产品-->
<MM:Insert
runat="server"
CommandText='<%# "INSERT INTO dbo.cuku_products (prodoucts, catid, content, recom, uptop, isnew, cont, pic) VALUES (?, ?, ?, ?, ?, ?, ?, ?)" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
Expression='<%# Request.Form["MM_insert"] == "form1" && Request.Form["id"].Trim()=="" %>'
CreateDataSet="false"
SuccessURL='<%# "adminproducts.aspx" %>'
FailureURL='<%# "adminproducts.aspx?act=add" %>'
Debug="true"
><Parameters>
<Parameter Name="@prodoucts" Value='<%# ((Request.Form["prodoucts"] != null) && (Request.Form["prodoucts"].Length > 0)) ? Request.Form["prodoucts"] : "" %>' Type="VarChar" />
<Parameter Name="@catid" Value='<%# ((Request.Form["catid"] != null) && (Request.Form["catid"].Length > 0)) ? Request.Form["catid"] : "" %>' Type="Integer" />
<Parameter Name="@content" Value='<%# ((Request.Form["content"] != null) && (Request.Form["content"].Length > 0)) ? Request.Form["content"] : "" %>' Type="VarChar" />
<Parameter Name="@recom" Value='<%# ((Request.Form["recom"] != null) && (Request.Form["recom"].Length > 0)) ? Request.Form["recom"] : "" %>' Type="Boolean" />
<Parameter Name="@uptop" Value='<%# ((Request.Form["uptop"] != null) && (Request.Form["uptop"].Length > 0)) ? Request.Form["uptop"] : "" %>' Type="Boolean" />
<Parameter Name="@isnew" Value='<%# ((Request.Form["isnew"] != null) && (Request.Form["isnew"].Length > 0)) ? Request.Form["isnew"] : "" %>' Type="Boolean" />
<Parameter Name="@cont" Value='<%# ((Request.Form["cont"] != null) && (Request.Form["cont"].Length > 0)) ? Request.Form["cont"] : "" %>' Type="VarChar" />
<Parameter Name="@pic" Value='<%# ((Request.Form["pic"] != null) && (Request.Form["pic"].Length > 0)) ? Request.Form["pic"] : "" %>' Type="VarChar" />
</Parameters>
</MM:Insert>
<MM:Update
runat="server"
CommandText='<%# "UPDATE dbo.cuku_products SET cont=?, content=?, isnew=?, recom=?, catid=?, pic=?, prodoucts=?, uptop=? WHERE id=?" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
Expression='<%# Request.Form["MM_update"] == "form1" && Request.Form["id"].Trim()!="" %>'
CreateDataSet="false"
SuccessURL='<%# "adminproducts.aspx" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@cont" Value='<%# ((Request.Form["cont"] != null) && (Request.Form["cont"].Length > 0)) ? Request.Form["cont"] : "" %>' Type="VarChar" />
<Parameter Name="@content" Value='<%# ((Request.Form["content"] != null) && (Request.Form["content"].Length > 0)) ? Request.Form["content"] : "" %>' Type="VarChar" />
<Parameter Name="@isnew" Value='<%# ((Request.Form["isnew"] != null) && (Request.Form["isnew"].Length > 0)) ? Request.Form["isnew"] : "" %>' Type="Boolean" />
<Parameter Name="@recom" Value='<%# ((Request.Form["recom"] != null) && (Request.Form["recom"].Length > 0)) ? Request.Form["recom"] : "" %>' Type="Boolean" />
<Parameter Name="@catid" Value='<%# ((Request.Form["catid"] != null) && (Request.Form["catid"].Length > 0)) ? Request.Form["catid"] : "" %>' Type="Integer" />
<Parameter Name="@pic" Value='<%# ((Request.Form["pic"] != null) && (Request.Form["pic"].Length > 0)) ? Request.Form["pic"] : "" %>' Type="VarChar" />
<Parameter Name="@prodoucts" Value='<%# ((Request.Form["prodoucts"] != null) && (Request.Form["prodoucts"].Length > 0)) ? Request.Form["prodoucts"] : "" %>' Type="VarChar" />
<Parameter Name="@uptop" Value='<%# ((Request.Form["uptop"] != null) && (Request.Form["uptop"].Length > 0)) ? Request.Form["uptop"] : "" %>' Type="Boolean" />
<Parameter Name="@id" Value='<%# ((Request.Form["id"] != null) && (Request.Form["id"].Length > 0)) ? Request.Form["id"] : "" %>' Type="Integer" />
</Parameters>
</MM:Update>
<MM:DataSet
id="rs"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
CommandText='<%# "SELECT * FROM dbo.cuku_cat ORDER BY id DESC" %>'
Debug="true"
></MM:DataSet>
<MM:DataSet
id="editrs"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
CommandText='<%# "SELECT * FROM dbo.cuku_cat WHERE id = ?" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@id" Value='<%# ((Request.QueryString["id"] != null) && (Request.QueryString["id"].Length > 0)) ? Request.QueryString["id"] : "" %>' Type="Integer" />
</Parameters>
</MM:DataSet>
<MM:DataSet
id="pds"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
CommandText='<%# "SELECT * FROM dbo.cuku_products,dbo.cuku_cat WHERE dbo.cuku_cat.id = dbo.cuku_products.catid ORDER BY dbo.cuku_products.id desc" %>'
CurrentPage='<%# ((Request.QueryString["pds_CurrentPage"] != null) && (Request.QueryString["pds_CurrentPage"].Length > 0)) ? Int32.Parse(Request.QueryString["pds_CurrentPage"]) : 0 %>'
PageSize="20"
Debug="true"
></MM:DataSet>
<MM:DataSet
id="editpds"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_conn"] %>'
CommandText='<%# "SELECT * FROM dbo.cuku_products WHERE id = ?" %>'
Expression='<%# Myac=="add" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@id" Value='<%# ((Request.QueryString["id"] != null) && (Request.QueryString["id"].Length > 0)) ? Request.QueryString["id"] : "" %>' Type="Integer" /> </Parameters>
</MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>产品管理</title>
<link href="images/admin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script>
function del(ids,what)
{
if(confirm("你确定要删除吗?")){
window.location.href="?act=del&do="+what+"&id="+ids;
}else{
return
}
}
</script>
<script runat="server">
private string myac;
public string Myac
{
get { return this.myac; }
set { this.myac = value; }
}
public string Checked(string chkstr)
{
return chkstr=="True" ? "checked=\"checked\"":"";
}
public void Page_Load(Object Src, EventArgs E)
{
if (Request.QueryString["act"]== null)
{
Myac="go";
}
else
{
Myac=Request.QueryString["act"].Trim();
}
}
</script>
<mm:if runat="server" expression='<%# Myac=="go" %>'>
<contentstemplate>
<table width="600" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td height="25" colspan="5" background="images/bg_lead.png"> 产品管理</td>
</tr>
<tr>
<td width="6%" align="center" bgcolor="#CCEAFA">编号</td>
<td width="25%" align="center" bgcolor="#CCEAFA">产品名称</td>
<td width="23%" align="center" bgcolor="#CCEAFA">分类</td>
<td width="23%" align="center" bgcolor="#CCEAFA">属性</td>
<td width="23%" align="center" bgcolor="#CCEAFA">管理</td>
</tr>
<ASP:Repeater runat="server" DataSource='<%# pds.DefaultView %>'>
<ItemTemplate>
<tr>
<td height="21" align="center" bgcolor="#CCEAFA"><%# pds.FieldValue("id", Container) %></td>
<td bgcolor="#CCEAFA"><%# pds.FieldValue("prodoucts", Container) %></td>
<td bgcolor="#CCEAFA"><%# pds.FieldValue("catname", Container) %></td>
<td bgcolor="#CCEAFA"><%# pds.FieldValue("isnew", Container) %><%# pds.FieldValue("recom", Container) %><%# pds.FieldValue("isnew", Container) %></td>
<td align="center" bgcolor="#CCEAFA"><a href="?act=add&id=<%# pds.FieldValue("id", Container) %>">修改</a> <a href="javascript:del('<%# pds.FieldValue("id", Container) %>','pro')">删除</a></td>
</tr>
</ItemTemplate>
</ASP:Repeater>
<tr>
<td colspan="5" align="center" bgcolor="#CCEAFA">首页 上一页 下一页 末页</td>
</tr>
</table>
</contentstemplate>
</mm:if>
<mm:if runat="server" expression='<%# Myac=="add" %>' >
<contentstemplate>
<form action="" method='POST' enctype="multipart/form-data" name='form1' id="form1" runat='server'>
<table width="600" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td height="27" colspan="2" background="images/bg_lead.png" bgcolor="#EFF9FE"> 修改/添加商品</td>
</tr>
<tr>
<td width="121" height="23" align="center" bgcolor="#CCEAFA">产品名称</td>
<td width="479" bgcolor="#CCEAFA"><label>
<input name="prodoucts" type="text" id="prodoucts" value="<%# editpds.FieldValue("prodoucts", Container) %>" />
<input name="id" type="hidden" id="id" value="<%# editpds.FieldValue("id", Container) %>" />
</label></td>
</tr>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA">产品分类</td>
<td bgcolor="#CCEAFA">
<select name="catid" id="catid">
<ASP:Repeater runat="server" DataSource='<%# rs.DefaultView %>'>
<ItemTemplate>
<option value="<%# rs.FieldValue("id", Container) %>"><%# rs.FieldValue("catname", Container) %></option>
</ItemTemplate>
</ASP:Repeater>
</select>
</td>
</tr>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA">商品图片</td>
<td bgcolor="#CCEAFA"><label>
<input name="pic" type="text" id="pic" value="<%# editpds.FieldValue("pic", Container) %>" />
</label></td>
</tr>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA">上传图片</td>
<td bgcolor="#CCEAFA"><label>
<input type="file" name="fileField" id="fileField" />
</label></td>
</tr>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA">说 明</td>
<td bgcolor="#CCEAFA"><input name="cont" type="text" id="cont" value="<%# editpds.FieldValue("cont", Container) %>" /></td>
</tr>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA">商品属性</td>
<td bgcolor="#CCEAFA"><label>
<input name="isnew" type="checkbox" id="isnew" value="true" <%# Checked(editpds.FieldValue("isnew", Container))%> />
新商品
<input name="recom" type="checkbox" id="recom" value="true" <%# Checked(editpds.FieldValue("recom", Container))%>/>
推荐
<input name="uptop" type="checkbox" id="uptop" value="true" <%# Checked(editpds.FieldValue("uptop", Container))%>/>
置顶
</label></td>
</tr>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA">介 绍</td>
<td bgcolor="#CCEAFA"><label>
<textarea name="content" id="content" cols="45" rows="5"><%# editpds.FieldValue("content", Container) %></textarea>
</label></td>
</tr>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA"> </td>
<td bgcolor="#CCEAFA"><label for="button"></label>
<input type="submit" name="button" id="button" value="提交" />
<label>
<input type="reset" name="button2" id="button2" value="重设" />
<input name="button3" type="button" id="button3" onclick="history.go(-1)" value="返回" />
</label></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
<input type="hidden" name="MM_update" value="form1" />
</form>
</contentstemplate>
</mm:if>
<mm:if runat="server" expression='<%# Myac=="class" %>' >
<contentstemplate>
<table width="387" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td height="25" colspan="5" align="center" background="images/bg_lead.png"> 分类列表</td>
</tr>
<tr>
<td width="27" height="23" align="center" bgcolor="#CCEAFA">编号</td>
<td width="79" align="center" bgcolor="#CCEAFA">分类名称</td>
<td width="30" align="center" bgcolor="#CCEAFA">顺序</td>
<td width="175" align="center" bgcolor="#CCEAFA">说明</td>
<td width="60" align="center" bgcolor="#CCEAFA">管理</td>
</tr>
<ASP:Repeater runat="server" DataSource='<%# rs.DefaultView %>'>
<ItemTemplate>
<tr>
<td height="23" align="center" bgcolor="#CCEAFA"> <%# rs.FieldValue("id", Container) %></td>
<td align="center" bgcolor="#CCEAFA"><%# rs.FieldValue("catname", Container) %></td>
<td align="center" bgcolor="#CCEAFA"><%# rs.FieldValue("catlist", Container) %></td>
<td bgcolor="#CCEAFA"><%# rs.FieldValue("catcont", Container) %></td>
<td bgcolor="#CCEAFA"><a href="?act=class&id=<%# rs.FieldValue("id", Container) %>">修改</a> <a href="javascript:del('<%# rs.FieldValue("id", Container) %>','class');">删除</a></td>
</tr>
</ItemTemplate>
</ASP:Repeater>
</table>
<form runat='server' id="form2" name='form2' method='POST' action="">
<table width="387" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td height="25" colspan="2" background="images/bg_lead.png"> 产品分类添加</td>
</tr>
<tr>
<td width="100" align="center">分类名称</td>
<td width="272"><label>
<input name="catname" type="text" id="catname" value="<%# editrs.FieldValue("catname", Container) %>" />
<input name="id" type="hidden" id="id" value="<%# editrs.FieldValue("id", Container) %>" />
</label></td>
</tr>
<tr>
<td align="center">分类顺序</td>
<td><input name="catlist" type="text" id="catlist" value="<%# editrs.FieldValue("catlist", Container) %>" /></td>
</tr>
<tr>
<td align="center">分类说明</td>
<td><input name="catcont" type="text" id="catcont" value="<%# editrs.FieldValue("catcont", Container) %>" /></td>
</tr>
<tr>
<td align="center"> </td>
<td><label>
<input type="submit" name="button4" id="button4" value="提交" />
<input type="reset" name="button5" id="button5" value="重置" />
<input type="button" name="button6" id="button6" value="返回" />
</label></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form2" />
<input type="hidden" name="MM_update" value="form2" />
</form>
</contentstemplate>
</mm:if>
</body>
</html>
winform頁面的傳值問題解決!
[
2008/02/01 11:04 | by Else ]
2008/02/01 11:04 | by Else ]
方法 網上很多,但我這個試了成功了
Form1中,按鍵事件
Form2中的接收方法
這樣的傳值就成功了
Form1中,按鍵事件
private void btn_time_Click(object sender, EventArgs e)
{
Form2 fm = Form2();
fm.A= a.Text;
fm.B = b.Text;
fm.C = c.Text;
fm.D =d.Text;
fm.Show();
}
{
Form2 fm = Form2();
fm.A= a.Text;
fm.B = b.Text;
fm.C = c.Text;
fm.D =d.Text;
fm.Show();
}
Form2中的接收方法
private string a;
....
private stirng d;
Public stirng A
{
get {return a;}
set { a = value;}
}
......
labela.Text=thsi.A;
...........
....
private stirng d;
Public stirng A
{
get {return a;}
set { a = value;}
}
......
labela.Text=thsi.A;
...........
這樣的傳值就成功了
ASP.NET WEB FORMS 给开发者提供了极好的事件驱动开发模式。然而这种简单的应用程序开发模式却给我们带来了一些小问题,举个例子,在传统的ASP应用程序中,你能够通过POST方法很容易的把一个值或多个值从一个页面传送到另一个页面,用同样的方法在ASP.NET中实现有点麻烦。在这里,我们可以通过其他方式来解决这种情形。ASP.NET为我们提供了三种方式,一种是可以通过用QueryString来传送相应的值,再一种是通过session变量来传送相应的值,还有就是通过Server.Transfer方法来实现。下面分别一一介绍:
一、使用Querystring
Querystring是一种非常简单的传值方式,其缺点就是会把要传送的值显示在浏览器的地址栏中,并且在此方法中不能够传递对象。如果你想传递一个安全性不是那么太重要或者是一个简单的数值时,用此方法最好不过了。下面通过一个小例子来完成传值工作,步骤如下:
一、使用Querystring
Querystring是一种非常简单的传值方式,其缺点就是会把要传送的值显示在浏览器的地址栏中,并且在此方法中不能够传递对象。如果你想传递一个安全性不是那么太重要或者是一个简单的数值时,用此方法最好不过了。下面通过一个小例子来完成传值工作,步骤如下:
今天早上推出的一個公式!
[
2008/01/28 12:58 | by Else ]
2008/01/28 12:58 | by Else ]
誰有更好的算法,請在下面跟
輸入A,R,N數值後, Click 試算可計算 P1,P2,P3 值, Check A,N 應為整數
r=R/12, n=12*N
P1=Q1+I1 Q1=A/n I1=A*r A1=A-Q1
P2=Q2+I2 Q2=A/n I2=A1*r A2=A1-Q2
P3=Q3+I3 Q3=A/n I3=A2*r A3=A2-Q3
Q1,Q2,Q3都等於A/n所以設Q=A/n
r=R/12, n=12*N
開始變化的月份設n
P1=Q+I1 Q=A/n I1=A*r A1=A-Q
P2=Q+I2 Q=A/n I2=A1*r A2=A1-Q
P3=Q+I3 Q=A/n I3=A2*r A3=A2-Q
Ax=A-Q*x
Ix = (A-Q*(x-1))*r
Px=Q+(A-Q*(x-1))*r
Px=A/n+(A-(A/n)*(x-1))*r
x是月份,
r=R/12, n=12*N
P1=Q1+I1 Q1=A/n I1=A*r A1=A-Q1
P2=Q2+I2 Q2=A/n I2=A1*r A2=A1-Q2
P3=Q3+I3 Q3=A/n I3=A2*r A3=A2-Q3
Q1,Q2,Q3都等於A/n所以設Q=A/n
r=R/12, n=12*N
開始變化的月份設n
P1=Q+I1 Q=A/n I1=A*r A1=A-Q
P2=Q+I2 Q=A/n I2=A1*r A2=A1-Q
P3=Q+I3 Q=A/n I3=A2*r A3=A2-Q
Ax=A-Q*x
Ix = (A-Q*(x-1))*r
Px=Q+(A-Q*(x-1))*r
Px=A/n+(A-(A/n)*(x-1))*r
x是月份,
Visual C# 2005编译器选项 csc的應用
[
2007/12/25 10:45 | by Else ]
2007/12/25 10:45 | by Else ]
Visual C# 2005 編譯器選項
- 輸出檔 -
/out: 指定輸出檔名 (預設: 具有主要類別或是第一個檔案的檔案主檔名)
/target:exe 建置主控台可執行檔 (預設) (簡短形式: /t:exe)
/target:winexe 建置 Windows 可執行檔 (簡短形式: /t:winexe)
/target:library 建置程式庫 (簡短形式: /t:library)
/target:module 建置可以加入至其他組件的模組 (簡短形式: /t:module)
/delaysign[+|-] 只使用強式名稱金鑰的公開金鑰延遲簽署組件
/doc: 要產生的 XML 文件檔案
/keyfile: 指定強式名稱金鑰檔
/keycontainer: 指定強式名稱金鑰容器
/platform: 限制這個程式碼可以在哪些平台執行: x86、Itanium、x64 或 anycpu。預設為 anycpu。
- 輸出檔 -
/out:
/target:exe 建置主控台可執行檔 (預設) (簡短形式: /t:exe)
/target:winexe 建置 Windows 可執行檔 (簡短形式: /t:winexe)
/target:library 建置程式庫 (簡短形式: /t:library)
/target:module 建置可以加入至其他組件的模組 (簡短形式: /t:module)
/delaysign[+|-] 只使用強式名稱金鑰的公開金鑰延遲簽署組件
/doc:
/keyfile:
/keycontainer:
/platform:
C#连接Access成功
[
2007/12/24 00:48 | by Else ]
2007/12/24 00:48 | by Else ]
C#链access 之前一直用链接sqlserver的函数做程序,一直出错,现在可以了
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;
namespace test.src.util
{
public class DbConnction
{
public DbConnction()
{
//
}
static void Main(string[] args)
{
String connectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=";
connectionString += @"d:\data.mdb";
OleDbConnection myConnection = new OleDbConnection(connectionString);
myConnection.Open(); //打开数据库链接
OleDbCommand myCommand = myConnection.CreateCommand(); //定义SqlCommand变量
myCommand.CommandText = "select * from ruby"; //设置SQL语句
OleDbDataReader myDataReader = myCommand.ExecuteReader(); // 从数据库获职数据
//读取DataReader中的数据并输出
while (myDataReader.Read())
{
Console.WriteLine("\t{0}\t{1}", myDataReader["id"], myDataReader["title"]);
}
myDataReader.Close(); //关闭SqlDataReader
myConnection.Close(); //关闭链接
Console.WriteLine("这个是一个链接的测试");
}
}
}
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;
namespace test.src.util
{
public class DbConnction
{
public DbConnction()
{
//
}
static void Main(string[] args)
{
String connectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=";
connectionString += @"d:\data.mdb";
OleDbConnection myConnection = new OleDbConnection(connectionString);
myConnection.Open(); //打开数据库链接
OleDbCommand myCommand = myConnection.CreateCommand(); //定义SqlCommand变量
myCommand.CommandText = "select * from ruby"; //设置SQL语句
OleDbDataReader myDataReader = myCommand.ExecuteReader(); // 从数据库获职数据
//读取DataReader中的数据并输出
while (myDataReader.Read())
{
Console.WriteLine("\t{0}\t{1}", myDataReader["id"], myDataReader["title"]);
}
myDataReader.Close(); //关闭SqlDataReader
myConnection.Close(); //关闭链接
Console.WriteLine("这个是一个链接的测试");
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
public class Test2
{
public void aaB(string a, int b)
{
if(a!=null)
{
Console.WriteLine("The stirng is " + a + ", the number is " + b);
}
else
{
Console.WriteLine("error");
}
}
public void checkType(object type)
{
Console.WriteLine("The "+type+" type is {0},", type.GetType());
}
public static void Main()
{
Test2 ts = new Test2();
string a="my name is a";
int b=3662296;
ts.aaB(a,b);
int i = 5;
string k="哈,今天的天氣不錯,我叫string ";
Console.WriteLine("i is an int ? {0}" , i.GetType() == typeof(int));
Console.WriteLine("i is an int ? {0}" , typeof(int).IsInstanceOfType(i));
Console.WriteLine("k is an int ? {0}" , typeof(int).IsInstanceOfType(k));
Console.WriteLine("The type of k is {0},",k.GetType());
ts.checkType(k);
ts.checkType(i);
}
}
using System.Collections.Generic;
using System.Text;
public class Test2
{
public void aaB(string a, int b)
{
if(a!=null)
{
Console.WriteLine("The stirng is " + a + ", the number is " + b);
}
else
{
Console.WriteLine("error");
}
}
public void checkType(object type)
{
Console.WriteLine("The "+type+" type is {0},", type.GetType());
}
public static void Main()
{
Test2 ts = new Test2();
string a="my name is a";
int b=3662296;
ts.aaB(a,b);
int i = 5;
string k="哈,今天的天氣不錯,我叫string ";
Console.WriteLine("i is an int ? {0}" , i.GetType() == typeof(int));
Console.WriteLine("i is an int ? {0}" , typeof(int).IsInstanceOfType(i));
Console.WriteLine("k is an int ? {0}" , typeof(int).IsInstanceOfType(k));
Console.WriteLine("The type of k is {0},",k.GetType());
ts.checkType(k);
ts.checkType(i);
}
}





