1. How do I get the form to center?
StartPosition set to Centerscreen
2. What are the benefits of not having a login form as a startup form in an application that has a login form?
1) When the main form is closed, you can exit the application directly;
2) The login form does not reside in memory for a long time.
3. How do I display another form in a multi-form application?
1) Create a (new) instance object variable to display the form;
2) Call the Show ()/showdialog () method of the instance object variable.
4. How do I display the login form before the Startup form (main form) is displayed?
1) in the Load event of the startup form, create a login form;
2) Call the ShowDialog () method of the Login form.
5. How do I get the return value from the dialog box form (the form shown by the ShowDialog () method)?
The DialogResult value of the dialog box form is.
6. How do I connect to an Access database?
1) using System.Data.OleDb; Link to Access database & SQL Database
Using System.Data.SqlClient; Link SQL Database
2) Set the parameters required to connect to the database
String constring =//Connection string (parameter string for linked database)
@ "Provider=Microsoft.Jet.OLEDB.4.0;" +
@ "Data Source=.\txl_db.mdb"; Disk database files
3) Create a Connection object variable
OleDbConnection con = new OleDbConnection ();
Con. ConnectionString = constring;
Con. Open ();
7. How to Query "Monkey King" is a legitimate user of the system?
1) Connect to the database
2) Define database Operations Command instance object variables
OleDbCommand cmd = new OleDbCommand ();
3) Set the connection object used by the command
Cmd. Connection = con;
4) Set the command content
Cmd.commandtext =
"Select" +
"Count (*)" +
"From" +
"[Tb_user]" +
"WHERE" +
"[Login name]= ' Monkey King ' and ' +
[Password]= ' Monkey King's password ';
Con. Open ();
5) Execute the query command and get the return value
int RecordCount = Convert.ToInt32 (cmd. ExecuteScalar ());
The return value is 1 o'clock, which indicates that there is a return value of 0 o'clock, indicating no.
Basic knowledge of C #