Today, there is nothing urgent to do. Just a few days ago, a netizen asked questions about Database Class settings. I hope he can understand the content, the most important thing about programming is to understand the memory by yourself. See more. Do more and ask more questions. This is an unbeaten option for me to learn ~~
The code for the data definition class is as follows:
Using system;
Using system. Data;
Using system. configuration;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. webcontrols. webparts;
Using system. Web. UI. htmlcontrols;
Using system. Data. oledb;
/// <Summary>
/// Summary of the database
/// </Summary>
Public class DB
{
Public dB ()
{
//
// Todo: add the constructor logic here
//
}
// Database connection
Public static oledbconnection con ()
{
Oledbconnection con = new oledbconnection (configurationsettings. deleettings ["strcon"]);
Return con;
}
// Verify Logon
Public static bool insert (string que)
{
Oledbconnection con = dB. Con ();
Con. open ();
Oledbcommand cmd = new oledbcommand (que, con );
Int COUNT = convert. toint32 (CMD. executenonquery ());
If (count> 0)
{Return true ;}
Else
{Return false ;}
}
// Fill in data
Public static datatable DS (string que)
{
Oledbconnection con = dB. Con ();
Oledbdataadapter da = new oledbdataadapter ();
Da. selectcommand = new oledbcommand (que, con );
Dataset DS = new dataset ();
Da. Fill (DS, "4ec ");
Return Ds. Tables ["4ec"];
}
Public static string SCR (string que)
{
Oledbconnection con = dB. Con ();
Con. open ();
Oledbcommand cmd = new oledbcommand (que, con );
Return cmd. executescalar (). tostring ();
}
}
I have found many examples on the Internet. Are there any plagiarism? I hope you will not be surprised at this. This is an introduction for beginners ..............