新聞網(wǎng)站aspnet課程設(shè)計報告樣本_第1頁
新聞網(wǎng)站aspnet課程設(shè)計報告樣本_第2頁
新聞網(wǎng)站aspnet課程設(shè)計報告樣本_第3頁
新聞網(wǎng)站aspnet課程設(shè)計報告樣本_第4頁
新聞網(wǎng)站aspnet課程設(shè)計報告樣本_第5頁
已閱讀5頁,還剩29頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

河南中醫(yī)學院《ASP.NET課程設(shè)計報告》所在院系:信息技術(shù)學院專業(yè)年級:級計算機科學與技術(shù)完畢學生:180106曽濤指引教師:曹莉ASP.NET課程設(shè)計報告-新聞網(wǎng)站目錄HYPERLINK+message+"')</script>",false);}publicstaticvoidAlert(stringmessage,Pagepage)//顯示對話框{page.Response.Write("<scriptlanguage='javascript'type='text/javascript'>functionwindow.onload(){alert('"+message+"');}</script>");}publicstaticvoidMsgBox(stringmessage,Pagepage)//顯示對話框{Stringcsname="PopupScript";//定義客戶端腳本名Typecstype=page.GetType();//定義客戶端腳本類型ClientScriptManagercs=page.ClientScript;//創(chuàng)立一種ClientScriptManager類if(!cs.IsStartupScriptRegistered(cstype,csname))//如果腳本沒有注冊{Stringcstext="alert('"+page.Server.HtmlEncode(message)+"');";cs.RegisterStartupScript(cstype,csname,cstext,true);}}publicstaticvoidMsgBox(stringmessage,stringurl,Pagepage){ClientScriptManagercs=page.ClientScript;//創(chuàng)立一種ClientScriptManager類Stringcsname="PopupScript";//定義客戶端腳本名Typecstype=page.GetType();//定義客戶端腳本類型if(!cs.IsStartupScriptRegistered(cstype,csname))//如果腳本沒有注冊{Stringcstext="alert('"+page.Server.HtmlEncode(message)+"');window.location='"+url+"';";cs.RegisterStartupScript(cstype,csname,cstext,true);}}publicvoidAlertBox(stringmessage,stringurl){System.Web.HttpContext.Current.Response.Write("<script>alert('"+message+"');location.href('"+url+"')</script>");}publicstaticvoidCClose(Pagepage){//GetaClientScriptManagerreferencefromthePageclassClientScriptManagercs=page.ClientScript;//DefinethenameandTypeoftheclientscriptonthepageStringcsname="close";Typecstype=page.GetType();//builderthescripttextStringBuildercstext=newStringBuilder();cstext.Append("<scriptlanguage='javascript'>");cstext.Append("{window.opener='anyone';window.close();}");cstext.Append("</script>");//Checktoseeifthestartupscriptisalreadyregisteredif(!cs.IsClientScriptBlockRegistered(cstype,csname)){cs.RegisterStartupScript(cstype,csname,cstext.ToString());}}//或inti=SqlHelper.GetExecuteNonQuery(sqlStr);publicstaticintGetExecuteNonQuery(stringsqlStr){OpenConnection();//打開連接cmd.CommandType=CommandType.Text;//定義為使用SQL語句cmd.CommandText=sqlStr;//初始化Command對象SQL字符串intresult=cmd.ExecuteNonQuery();//執(zhí)行SQL語句并返回受影響行數(shù)CloseConnection();//關(guān)閉連接returnresult;//返回整數(shù)}publicstaticintGetExecuteNonQuery(stringsqlStr,paramsSqlParameter[]values){OpenConnection();cmd.CommandType=CommandType.Text;cmd.CommandText=sqlStr;cmd.Parameters.AddRange(values);//添加參數(shù)集intresult=cmd.ExecuteNonQuery();CloseConnection();cmd.Parameters.Clear();returnresult;}publicstaticobjectGetExecuteScalar(stringsqlStr){OpenConnection();cmd.CommandType=CommandType.Text;cmd.CommandText=sqlStr;objectresult=cmd.ExecuteScalar();//執(zhí)行SQL語句CloseConnection();returnresult;//返回獲得單個值}publicstaticobjectGetExecuteScalar(stringsqlStr,paramsSqlParameter[]values){OpenConnection();cmd.CommandType=CommandType.Text;cmd.CommandText=sqlStr;cmd.Parameters.Clear();cmd.Parameters.AddRange(values);objectresult=cmd.ExecuteScalar();CloseConnection();cmd.Parameters.Clear();returnresult;}publicstaticSqlDataReaderGetExecuteReader(stringsqlStr){OpenConnection();cmd.CommandType=CommandType.Text;cmd.CommandText=sqlStr;SqlDataReaderreader=cmd.ExecuteReader();//這里不能關(guān)閉連接CloseConnection(),要在調(diào)用中關(guān)閉returnreader;}publicstaticSqlDataReaderGetDataReader(stringsqlStr,paramsSqlParameter[]values){OpenConnection();cmd.CommandType=CommandType.Text;cmd.CommandText=sqlStr;cmd.Parameters.AddRange(values);SqlDataReaderreader=cmd.ExecuteReader();//這里不能關(guān)閉連接CloseConnection(),要在調(diào)用中關(guān)閉cmd.Parameters.Clear();returnreader;}publicstaticDataSetGetDataSet(stringsqlStr){SqlDataAdapterda=newSqlDataAdapter();OpenConnection();cmd.CommandType=CommandType.Text;cmd.CommandText=sqlStr;da.SelectCommand=cmd;DataSetds=newDataSet();da.Fill(ds);CloseConnection();returnds;//返回DataSet對象}publicstaticDataSetGetDataSet(stringsqlStr,paramsSqlParameter[]values){SqlDataAdapterda=newSqlDataAdapter();OpenConnection();cmd.CommandType=CommandType.Text;cmd.CommandText=sqlStr;cmd.Parameters.AddRange(values);da.SelectCommand=cmd;DataSetds=newDataSet();da.Fill(ds);CloseConnection();cmd.Parameters.Clear();returnds;//返回DataSet對象}publicstaticDataSetGetDataSet(stringsqlStr,stringtableName){SqlDataAdapterda=newSqlDataAdapter();OpenConnection();cmd.CommandType=CommandType.Text;cmd.CommandText=sqlStr;da.SelectCommand=cmd;DataSetds=newDataSet();da.Fill(ds,tableName);CloseConnection();returnds;//返回DataSet對象}publicstaticDataTableGetDataTable(StringsqlStr){OpenConnection();cmd.CommandType=CommandType.Text;cmd.CommandText=sqlStr;DataTabledt=newDataTable();//創(chuàng)立一種數(shù)據(jù)表dtSqlDataAdapterda=newSqlDataAdapter(cmd);//定義并初始化數(shù)據(jù)適配器da.Fill(dt);//將數(shù)據(jù)適配器中數(shù)據(jù)填充到數(shù)據(jù)集dt中CloseConnection();returndt;}publicstaticDataTableGetDataTable(stringsqlStr,paramsSqlParameter[]values){OpenConnection();cmd.CommandType=CommandType.Text;cmd.CommandText=sqlStr;cmd.Parameters.AddRange(values);DataSetds=newDataSet();SqlDataAdapterda=newSqlDataAdapter(cmd);da.Fill(ds);CloseConnection();cmd.Parameters.Clear();returnds.Tables[0];}publicstaticDataViewGetDataView(stringsqlStr){SqlDataAdapterda=newSqlDataAdapter();DataViewdv=newDataView();DataSetds=newDataSet();OpenConnection();cmd.CommandType=CommandType.Text;cmd.CommandText=sqlStr;da.SelectCommand=cmd;da.Fill(ds);dv=ds.Tables[0].DefaultView;CloseConnection();returndv;}publicstaticvoidGetAlert(stringmessage,Pagepage)//顯示對話框{page.ClientScript.RegisterStartupScript(page.GetType(),"","<scriptlanguage='javascript'type='text/javascript'>alert('"+message+"')</script>",false);}publicstaticvoidAlert(stringmessage,Pagepage)//顯示對話框{page.Response.Write("<scriptlanguage='javascript'type='text/javascript'>functionwindow.onload(){alert('"+message+"');}</script>");}//調(diào)用辦法:SqlHelper.Alert("您已經(jīng)被禁止登錄,請關(guān)閉本頁后稍后再登錄!",Page);///<summary>///警告窗口,服務(wù)器端彈出alert對話框,彈出對話框而不丟失背景///</summary>///<paramname="message">提示信息,例子:"不能為空!"</param>///<paramname="page">Page類</param>publicstaticvoidMsgBox(stringmessage,Pagepage)//顯示對話框{Stringcsname="PopupScript";//定義客戶端腳本名Typecstype=page.GetType();//定義客戶端腳本類型ClientScriptManagercs=page.ClientScript;//創(chuàng)立一種ClientScriptManager類if(!cs.IsStartupScriptRegistered(cstype,csname))//如果腳本沒有注冊{Stringcstext="alert('"+page.Server.HtmlEncode(message)+"');";cs.RegisterStartupScript(cstype,csname,cstext,true);}}publicstaticvoidMsgBox(stringmessage,stringurl,Pagepage){ClientScriptManagercs=page.ClientScript;//創(chuàng)立一種ClientScriptManager類Stringcsname="PopupScript";//定義客戶端腳本名Typecstype=page.GetType();//定義客戶端腳本類型if(!cs.IsStartupScriptRegistered(cstype,csname))//如果腳本沒有注冊{Stringcstext="alert('"+page.Server.HtmlEncode(message)+"');window.location='"+url+"';";cs.RegisterStartupScript(cstype,csname,cstext,true);}}publicvoidAlertBox(stringmessage,stringurl){System.Web.HttpContext.Current.Response.Write("<script>alert('"+message+"');location.href('"+url+"')</script>");}publicstaticvoidCClose(Pagepage){//GetaClientScriptManagerreferencefromthePageclassClientScriptManagercs=page.ClientScript;//Defineth

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論