usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespace图书管理系统{publicpartialclass登录窗口:Form{//publicstaticstringConnectionString="Server=(local);database=图书管理库;uid=sa;pwd=1234";//sqlserver混合模式//publicstaticstringConnectionString="Server=(local);IntegratedSecurity=SSPI;database=图书管理库";//windows模式publicstringstrSQL;publicSqlConnectionmyConnection;publicSqlCommandBuildersqlCmdBld;publicDataSetds=newDataSet();publicSqlDataAdapterda;publicintnum=0;privateDataTablemyTable;privateDataRowmyRow;publicstaticstringstrUser;publicstaticstringstrPassword;//publicstaticstringstrDepartment;publicstaticboollogin_flag=false;public登录窗口(){InitializeComponent();}privatevoidbutton2_Click(objectsender,EventArgse){Close();}privatevoid登录窗口_Load(objectsender,EventArgse){linkdatabaselink=newlinkdatabase();//实例化myConnection=newSqlConnection(link.connectionstring());//实例化连接strSQL="select*from用户表";da=newSqlDataAdapter(strSQL,myConnection);ds.Clear();da.Fill(ds,"用户表");//////动作myTable=ds.Tables["用户表"];for(inti=0;i<myTable.Rows.Count;i++){comboBox1.Items.Add(myTable.Rows[i]["用户名"].ToString().Trim());}}privatevoidbutton1_Click(objectsender,EventArgse){linkdatabaselink=newlinkdatabase();//实例化myConnection=newSqlConnection(link.connectionstring());//实例化连接strSQL="sele
2024/8/20 10:41:13
7.26MB
管理
1