SQL data type

Source: Internet
Author: User
Set the field to uniqueidentifier and display it as a 32-bit binary code. The advantage is that when several systems are integrated and do not conflict with the ID, 8-4-4-12 combination;

Public static agent createagent (Agent agent)
{
Iconnection CNN = connectionmanager. getconnection ();
CNN. open ();
Itransaction trans = CNN. begintransaction ();
Icommand cmd;
Int I = 0;
Int deletedrows = 0;

Guid agentid = guid. newguid ();
String SQL = "insert into [B2B _agent] ("
+ "[Agentid], [Code], [type], [level],"
+ "[CompanyName], [companynameshort], [provincecode], [citycode],"
+ "[Address], [postcode], [linkman], [email], [tel],"
+ "[Mobiletel], [MSN], [QQ], [isprovider], [ispurchaser], [State], [registerdate], [introducer], [commisionmode])"
+ "Values ("
+ "?, '',?, ?, "
+ "?, ?, ?, ?, "
+ "?, ?, ?, ?, ?, "
+ "?, ?, ?, ?, ?, ?, Getdate (),'',?) ";
Cmd = CNN. createcommand (SQL );
Cmd. Transaction = trans;
Cmd. setguid (I, agentid); I ++;
Cmd. setint (I, agent. type); I ++;
Cmd. setint (I, agent. Level); I ++;
Cmd. setnvarchar (I, agent. companyName); I ++;
Cmd. setnvarchar (I, agent. companynameshort); I ++;
Cmd. setint (I, agent. provincecode); I ++;
Cmd. setint (I, agent. citycode); I ++;
Cmd. setnvarchar (I, agent. Address); I ++;
Cmd. setvarchar (I, agent. postcode); I ++;
Cmd. setnvarchar (I, agent. linkman); I ++;
Cmd. setvarchar (I, agent. Email); I ++;
Cmd. setvarchar (I, agent. Tel); I ++;
Cmd. setvarchar (I, agent. mobiletel); I ++;
Cmd. setvarchar (I, agent. MSN); I ++;
Cmd. setvarchar (I, agent. qq); I ++;
Cmd. setbit (I, agent. isprovider); I ++;
Cmd. setbit (I, agent. ispurchaser); I ++;
Cmd. setint (I, agent. State); I ++;
Cmd. setint (I, agent. commisionmode); I ++;
// Cmd. setbit (I, agent. isprovider); I ++;
// Cmd. setbit (I, agent. ispurchaser); I ++;

Try
{
Deletedrows = cmd. executenonquery ();
}
Catch (exception E)
{
Goto error;
}

If (! (Deletedrows> 0 ))
{
Goto error;
}

Trans. Commit ();
CNN. Close ();
Return getagentbyid (agentid );

Error:
Trans. rollback ();
CNN. Close ();
Return NULL;
}"? "To prevent code confusion; or delete Table1 where a = 1 or 1 = 1

Declare @ A varchar set @ A = '1 or 1 = 1'
Delete Table1 where a = @

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.