C#Á¬½ÓACESSʱ£¬sqlÓï¾äÓдí
ÔÚдsqlÓï¾äʱ£¬Ò»°ã¶¼ÊÇÒ»¾ä½â¾ö£¬´ÓÀ´Ã»Ïë¹ý˵£¬°ÑsqlÓï¾ä²ð¿ªÀ´Ð´¡£
ÀýÈçÏÂÃæÕâ¾ä£º string readstring = "select * from ʵÀý where ʵÀýID='"+eid+"'";
È»ºóÖ´ÐÐ Myconnection();
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(readstring, Mycon);
Õâʱºò¾Í»á±¨´í¡£¡£²»ÊÇ˵“sqlÓï¾äÓд픣¬¾ÍÊÇ“Êý¾ÝÀàÐͲ»Æ¥Å䔣¬¸üÂé·³µÄÊÇ£¬ÔËÐгɹ¦ÁË£¬µ«ÊÇÔËÐеĽá¹ûÒ»Ö±ÓÐ´í¡£¡£
ºóÀ´£¬²Å·¢ÏÖÔÀ´Èç¹ûÁ¬½ÓµÄÊÇacessµÄ»°£¬ÒÔÉϵÄÕâ¾äsqlÊÇÒª±ä³ÉÏÂÃæÕâÑùдµÄ£º
string readstr = "select * from ʵÀý where ʵÀýID=";
string readstring = readstr + eid;
ÏñÏÂÃæÕâÑùµÄ´úÂ룬²ÅÄÜÔËÐÐÎÞÎó£º
int eid = Form1.int_selected + 1;
string readstr = "select * from ʵÀý where ʵÀýID=";
string readstring = readstr + eid;
Myconnection();//Á¬½ÓÊý¾Ý¿â
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(readstring, Mycon);
da.Fill(ds, "ʵÀý");
qbox1.Text = ds.Tables[0].Rows[0][3].ToString();
dxbox1.Text = ds.Tables[0].Rows[0][4].ToString();
Ïà¹ØÎĵµ£º
--¾ÛºÏº¯Êý
use pubs
go
select avg(distinct price) --Ëãƽ¾ùÊý
from titles
where type='business'
go
use pubs
go
select max(ytd_sales) --×î´óÊý
from titles
go
use pubs
go
select min(ytd_sales) --×îÐ¡Ê ......
ÓйطÖÒ³ SQL µÄ×ÊÁϺܶ࣬ÓеÄʹÓô洢¹ý³Ì£¬ÓеÄʹÓÃÓαꡣ±¾È˲»Ï²»¶Ê¹ÓÃÓα꣬ÎÒ¾õµÃËüºÄ×Ê¡¢Ð§Âʵͣ»Ê¹Óô洢¹ý³ÌÊǸö²»´íµÄÑ¡Ôñ£¬ÒòΪ´æ´¢¹ý³ÌÊǾ¹ýÔ¤±àÒëµÄ£¬Ö´ÐÐЧÂʸߣ¬Ò²¸üÁé»î¡£ÏÈ¿´¿´µ¥Ìõ SQL Óï¾äµÄ·ÖÒ³ SQL °É¡£
·½·¨1£º
ÊÊÓÃÓÚ SQL Server 2000/2005
SELECT TOP Ò³´óС *
from tab ......
num_field number(12,2);
±íʾnum_fieldÊÇÒ»¸öÕûÊý²¿·Ö×î¶à10λ¡¢Ð¡Êý²¿·Ö×î¶à2λµÄ±äÁ¿¡£
case.....when Ó÷¨£¨Óëdecode£¨£©×÷ÓúÜÏñ£©
select case zsxm_dm
when '02' then
'Ó ......
sqlȨÏÞ:
´´½¨User:
insert into mysql.user(Host,User,Password)
values("localhost","cordev",password("xasoftorg"));
insert into
mysql.user(Host,User,Password)
values("localhost","corhotfix",password("xasoftorg"));
insert into
mysq ......