Using System;
Using System.Data;
Using System.Data.SqlClient;
Namespace Sysclasslibrary
{
Summary description of the DataAccess.
public class DataAccess
{
#region Properties
Protected static SqlConnection conn=new SqlConnection ();
protected static SqlCommand comm=new SqlCommand ();
#endregion
Public DataAccess ()
{
Init ();
}
The DataAccess () constructor is not executed in the static method of #region intrinsic function
Open a database connection
asp.net| Access | data using System;
Using System.Data;
Using System.Data.SqlClient;
Namespace Sysclasslibrary
{
Summary description of the DataAccess.
public class DataAccess
{
#region Properties
Protected static SqlConnection conn=new SqlConnection ();
protected static SqlCommand comm=new SqlCommand ();
#endregion
Public DataAccess ()
{
Init ();
}
The DataAccess () constructor is not executed in the static method of #region intrinsic function
Open
Oracle Learning (1): basic syntaxAfter logging on to and installing Oracle with the basic Oracle syntax, enable the Oracle service in services, run cmd, and enter sqlplus scott/Your scott PasswordConnection successful. Screen recording and cleaning
SQL> -- screen recording is a txt file
SQL> spool off
SQL> -- clear screenSQL> host cls
Select basic query SQL> -- tables under the current user
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
-----------------------------------------------
DEPT TA
database for user query convenience, so dedicated to provide a "dual" virtual table.Example: observing a function that turns uppercaseSELECT UPPER (' Hello ') from dual;sql> SELECT UPPER (' Hello ') from dual; UPPER-----HELLOThe use of uppercase conversions: In general usage, when the user input data to care about the data itself is stored in uppercase and lowercase?SELECT * from emp WHERE ename= ' str ';Sql> SELECT * from emp where ename= ' str '; input str value: Smith original Value 1:se
'); If v_sal Update emp set sal=v_sal+200 where lower (ename) =lower (' name '); dbms_output.put_l INE (' to employees: ' | | ' name ' | | ' Wages increased by 200. '); End If; End; 2.2 Binary Conditional branching Syntax 2: If logical expression 1 then Statement 1; else Statement 2; End If; Example 1: Declare v_sal number; V_avg number; Begin Select AVG (SAL) into the v_avg from EMP; Select Sal to v_sal from EMP where empno=7788; If V_sal>v_avg Then Dbms_output.put_line ('
string in Java?---java and string concatenation, it really spelled a null---package Oracle;--public class Demo {--public static void main (String[]args) {--String Str=null;--System.out.println ("str:" +STR);--}--}--->str:null---and numeric operations, the result is still null.---View each employee's income (Payroll plus performance)SELECT ename,sal,comm,sal+comm from EMP_RR;---null value function---1.NVL (
Ado|web four, Command object:
As you can see from the literal meaning of English, command is used to perform commands and parameter passing. The command object's bulk parameter transmission, storedprocude execution, and so on flexible and powerful function is also the reason that it is favored. The command object is primarily about passing parameters to SQL statements, Storedprocude, and relying on the powerful capabilities of SQL Server to complete the operation of the database, and the Records
Common Oracle functions: nvl/nullif/case when/wm_concat/replace 1. nvl function nvl converts a null value to an actual value. The data type can be date, number, character, and data type must match: nvl (commision, 0) nvl (hiredate, '01-JAN-87 ') nvl (job_id, 'no manager') nvl (to_char (job_id), 'no manager') nvl can convert any data type, however, the returned value of the converted data type must be of the expr type of the first parameter nvl (expr1, expr2. example: date, number, varchar2 or ch
From: http://www.lemongtree.com/2006/11/28/0000572.aspxA friend on csdn asked this question and wrote it later.
Why do we need to customize it?First, customization is more flexible and does not rely too much on the aspnetdb database, which facilitates your own expansion. Second, you can still use the login control in. NET 2.0 after customization.Of course, custom is not customized at will, but two abstract classes are implemented:Membershipprovider and roleproviderFor more information about th
ADO. An overview of the 5 large objects in net :1---Connection object : Connect to the database.(1) Log in with SAconn = new SqlConnection ("Data source=newland-pc;initial catalog=srr1100u; User id=sa;pwd=123456; " ); Conn. Open (); (2) using Windows Local Login New SqlConnection ("Data source=newland-pc;initial catalog=image;integrated security=true;" 2---Command object : Executes the T-SQL statement.(1) ExecuteNonQuery () method, perform additions and deletions to change the command.
compare to the relationship value and instead to the exist () with Sql:column ().Http://msdn.microsoft.com/zh-cn/library/ms178030.aspxImplemented using the XML value method (not recommended)
Copy Code code as follows:
DataTable dt = new DataTable ();
using (SqlConnection conn = new SqlConnection (connectionString))
{
string xml = @ "
SqlCommand COMM = conn. CreateCommand ();
Using the value method is not recommended, and performance
column Name 1, column name 2,..., column name n from table name;Exercise: Select Empno,ename,sal,comm,deptno from EMP;3.3 Queries show the Dept Department: Department number, department name, areaSelect Deptno,dname,loc from dept; --"Summary" FROM clause-------------------------------------------------------------------------------------Query all fields of a table: field names are available * instead. Select Column Name 1, column Name 2, ..., column
I. SQL trigger sending
Ii. Send the winform program with the task plan
Page
// ReferenceUsing System. Data. Common;Using System. Data. SqlClient;Using System. Configuration;Using System. Data;Using System. Net. Mail;
// The email to be sentPublic static DataSet SendEmailList (){DataSet ds = new DataSet ();Try{String str = ConfigurationSettings. etettings ["ConnectionString"];SqlConnection conn = new SqlConnection (str );Conn. Open ();SqlCommand comm
connectionSqlconnection conn = new sqlconnection (sqlconnstring );Try{Conn. open ();}Catch (exception E){// Record the cause if the connection failsEventLog. writeentry (E. Message );Return;}// Start the transactionSqltransaction TRAN = conn. begintransaction ();Sqlcommand comm = new sqlcommand ();
Comm. Transaction = Tran;Comm. Connection = conn;Try{// Obtain t
Oracle analysis function PERCENTILE_CONT
Query the salaries of people with the salary distribution of 25%, 50%, and 75% in each department. percent_rank () is the relative position in the ranking.
Create table EMP (empno number (4) not null, ENAME VARCHAR2 (10), JOB VARCHAR2 (9), mgr number (4), hiredate date, sal number (7, 2 ), comm number (7369), deptno number (2); insert into emp (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL,
Oracle Advanced query over (partitionby ..)
To facilitate learning and testing, all examples are created under Scott, an Oracle user.
create table EMP( empno NUMBER(4) not null, ename VARCHAR2(10), job VARCHAR2(9), mgr NUMBER(4), hiredate DATE, sal NUMBER(7,2), comm NUMBER(7,2), deptno NUMBER(2))alter table EMP add constraint PK_EMP primary key (EMPNO);insert into EMP (empno, ename, job, mgr, hiredate, sal,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.