ASP.NetÖÐʹÓÃVB.Netµ÷Óô洢¹ý³Ì²¢µÃµ½·µ»ØÖµ
ASP.NetÖÐʹÓÃVB.Netµ÷Óô洢¹ý³Ì²¢µÃµ½·µ»ØÖµ
À´Ô´£ºqqreadÂÛ̳ ×÷Õߣº ³ö´¦£ºÇÉÇɶÁÊé 2006-08-03 ½øÈëÌÖÂÛ×é
//´æ´¢¹ý³Ì´úÂë
¡¡CREATE PROCEDURE [AddNewInvoiceInfo] (@sUserID int,@sClaimMethod varchar(50),@sInvoiceNum ¡¡varchar(50),@sInvoiceDate datetime,@sBuyCity varchar(50))AS
¡¡Insert Into SMB_InvoiceInfo (MemberID,ClaimMethod,InvoiceNum,InvoiceDate,InvoiceCity) Values ¡¡(@sUserID,@sClaimMethod,@sInvoiceNum,@sInvoiceDate,@sBuyCity)
¡¡return @@IDENTITY
¡¡GO
//µ÷Óô洢¹ý³Ì´úÂë
¡¡Dim CN As New SqlConnection()
¡¡Dim InvoiceID As String
¡¡Try
CN.ConnectionString = DBConStr
CN.Open()
Dim CMD As SqlCommand
CMD = New SqlCommand(AddNewInvoiceInfo, CN)
CMD.CommandType = CommandType.StoredProcedure
CMD.Parameters.Add(New SqlParameter(@sUserID, SqlDbType.Int))
CMD.Parameters(@sUserID).Value = CInt(UserID.Text)
CMD.Parameters.Add(New SqlParameter(@sClaimMethod, SqlDbType.VarChar, 50))
CMD.Parameters(@sClaimMethod).Value = TransName.Text
CMD.Parameters.Add(New SqlParameter(@sInvoiceNum, SqlDbType.VarChar, 50))
CMD.Parameters(@sInvoiceNum).Value = InvoiceNum.Text
CMD.Parameters.Add(New SqlParameter(@sInvoiceDate, SqlDbType.DateTime))
CMD.Parameters(@sInvoiceDate).Value = InvoiceDate.SelectedDate.Date
CMD.Parameters.Add(New SqlParameter(@sBuyCity, SqlDbType.VarChar, 50))
CMD.Parameters(@sBuyCity).Value = BuyCity.Text
CMD.Parameters.Add(New SqlParameter(@sInvoiceID, SqlDbType.Int))
CMD.Parameters(@sInvoiceID).Direction = ParameterDirection.ReturnValue
CMD.ExecuteNonQuery()
InvoiceID = CMD.Parameters(@sInvoiceID).Value.ToString()
CMD.Dispose()
¡¡Catch ex As Exception
&
Ïà¹ØÎĵµ£º
Stephen Walther
Superexpert
ÊÊÓÃÓÚ£º
Microsoft ASP.NET 2.0
Microsoft Visual Studio 2005
¼ò½é
ÔÚ Microsoft ASP.NET 2.0 Framework ÖУ¬Êý¾Ý¿â·ÃÎʵõ½Á˼«´óµÄ¼ò»¯¡£ÀûÓÃÈ«Ð嵀 SqlDataSource ¿Ø¼þ£¬ÄúÎÞÐè±àдһÐдúÂë¾Í¿ÉÒÔÑ¡Ôñ¡¢¸üС¢²åÈëºÍɾ³ýÊý¾Ý¿âÊý¾Ý¡£
Éú³É¼òµ¥µÄÓ¦ÓóÌÐòʱ£¬SqlDataSource ¿ ......
.ascx webÓû§¿Ø¼þ
.asmx web·þÎñ
.asax È«¾ÖÓ¦ÓóÌÐòÀà
.sitemap ÍøÕ¾µØͼ
.htm HTMLÒ³
.xml XMLÒ³
.master ĸ°æÒ³
.config webÅäÖÃÎļþ
.skin Íâ¹ÛÎļþ
.css Ñùʽ±íÎļþ ......
ÔÚÒ³Ãæ»ùÀàÖÐÔö¼ÓÒÔÏ·½·¨,Äܹ»»ñµÃ±Èoverride void OnError(EventArgs e)¸ü¸ßµÄ´íÎó´¦ÀíÓÅÏȼ¶ºÍ¿ØÖÆȨ,override void OnError(EventArgs e)·½Ê½ÖÐOnError±»Ö´ÐÐÍê±Ïºó»ùÀà(Page)µÄOnErrorÔÚºóÐø±»µ÷ÓÃ,µ±Ç°Ò³ÃæË漴ɥʧ¿ØÖÆȨ.
protected void Page_Error(object sender, EventArgs e)
{
&nb ......
ÎÒÃÇ»¹¿ÉÒÔ²ÉÓÃÒ»ÖÖ¸ü¼Ó¼ò±ãµÄ·½
·¨À´ÊµÏÖÉÏÊö³ÌÐòµÄ¹¦ÄÜ¡£Õâ¾ÍÊǽ«SqlConnection¶ÔÏó°üº¬µ½usingÇø¿éÖУ¬ÕâÑù³ÌÐò»á×Ô¶¯µ÷ÓÃDispose()·½·¨ÊÍ·Å
SqlConnection¶ÔÏóËùÕ¼ÓõÄϵͳ×ÊÔ´£¬ÎÞÐèÔÙʹÓÃSqlConnection¶ÔÏóµÄClose()·½·¨¡£
·¶Àý³ÌÐò´úÂëÈçÏ£º
public partial class _Default : System.Web.UI.Page
{
......
Process p = new Process();
p.StartInfo.FileName = "cmd.exe"; //設¶¨³ÌÐòÃû
p.StartInfo.Arguments = "/c " command; //設¶¨³Ìʽ執ÐÐ參數
p.StartInfo.UseShellExecute = false; //關閉ShellµÄʹÓÃ
p.StartInfo.RedirectStandardInput = true; //Öض¨Ïò標準 ......