欢迎来到天天文库
浏览记录
ID:9284889
大小:26.55 KB
页数:30页
时间:2018-04-26
《delphi源代码(delphi源代码)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、delphi源代码(Delphi源代码)ConductingproblemcodeUsingSystem;UsingSystem.Data;UsingSystem.Configuration;UsingSystem.Web;UsingSystem.Web
2、.Security;UsingSystem.Web.UI;UsingSystem.Web.UI.WebControls;UsingSystem.Web.UI.WebControls.WebParts;UsingSystem.Web.UI.HtmlControls;UsingSystem.Data.SqlClient;Publicpartialclass_Default:System.Web.UI.Page{ProtectedvoidPage_Load(objectsender,EventArgsE)
3、{}ProtectedvoidButton1_Click(objectsender,EventArgsE)------------------------------------Commonlyusedthansimplestatements;Messagebox.show("HELLO,WORLD");Label2.hide();controlhide;;Textbox1.clear();TheInwebcode,ifyouwanttolinktothedatabase,youonlyneedto
4、refertoweb.configinkey.Forexample:Thedefinitionofdatabaseconnectioninweb.configisasfollows:Then,whenyouwanttoconn
5、ecttothedatabaseinthepagecode:SqlConnectionconn=newSqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);------------------------------------------------------------------------Databaseconnection:Privatevoidbutton1_Click(objectsender,Eve
6、ntArgsE){Label1.Text=textBox1.Text;SqlConnectionnwindconn=newSqlConnection("DataSource=WORKKAOQIN;InitialCatalog=worksystem;PersistSecurityInfo=True;UserID=sa;pwd=sa");//sqlconnectionobjectlinkingdatasource;SqlCommandcatCMD=nwindconn.CreateCommand();Ca
7、tCMD.CommandText="selectemp_id,card_idfromemployee"";Nwindconn.Open();SqlDataReadermyReader=catCMD.ExecuteReader();While(myReader.Read()){Console.WriteLine("t{0}t{1}",myReader.GetString(0),myReader.GetString(1));}MyReader.Close();Nwindconn.Close();}[
8、reprinted]SqlConnectiondatabaseconnectionseveralways(2010-06-2310:50:04)Reprinttheoriginallabel:reprintclassification:SQLdatabaseTextaddress:SqlConnectiondatabaseconnectionseveralways:Author:len2009Theconnectionstringhasseveralforms,som
此文档下载收益归作者所有