Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQL »ù±¾²Ù×÷ ɾ³ý ÐÞ¸Ä Ë¢Ð Ð޸İæ

C# Êý¾Ý¿âÖ®ÂÃ……
¼ÌÐø½ø¹¥²ã³ö²»ÇîµÄproblems
ÔÚÉÏһƪÄÚÈݵĻù´¡ÉÏ£¬ÎÒÓÖ×÷ÒԸĽø£¬ÏÖÔÚµÄÇé¿öÊÇÕâÑùµÄ£º
 //In Browseuser form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using System.Data.SqlClient;
namespace Str
{
public partial class Browseuser : Form
{
public Browseuser()
{
InitializeComponent();
}

//define Êý¾Ý¼¯¶ÔÏódsÓÃÓÚ±£´æ²éѯ·µ»ØµÄ½á¹û¼¯
DataSet ds;
private void Browseuser_Load(object sender, EventArgs e)
{
string strConnection = ConfigurationSettings.AppSettings["connectionstring"];
SqlConnection objConnection = new SqlConnection(strConnection);
objConnection.Open();
string sql = "select userid as userid,name as name from judging";
SqlDataAdapter adp = new SqlDataAdapter(sql, objConnection);
ds = new DataSet();
ds.Clear();
adp.Fill(ds, "judging");
dataGridView1.DataSource=ds. Tables[0].DefaultView;
dataGridView1.Refresh();
this.judgingTableAdapter.Fill(this.masterDataSet.judging);
}
/**********************************************************************************************/
/*ÖÁ´ËÍê³ÉÁ˽«Êý¾Ý¿âjudgingÖеÄÄÚÈÝÈ«²¿ÏÔʾÔÚÐÂform——BrowseuserÉÏ*/
/**********************************************************************************************/
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
this.Close();
}
//define a delegate instance in order to refresh
delegate void UseF();
/****************


Ïà¹ØÎĵµ£º

sql´óÊý¾Ý²Ù×÷ÈçºÎÓÅ»¯

¾ßÌåҪעÒâµÄ£º  
1.Ó¦¾¡Á¿±ÜÃâÔÚ where ×Ó¾äÖжÔ×ֶνøÐÐ null ÖµÅжϣ¬·ñÔò½«µ¼ÖÂÒýÇæ·ÅÆúʹÓÃË÷Òý¶ø½øÐÐÈ«±íɨÃ裬È磺  
select id from t where num is null  
¿ÉÒÔÔÚnumÉÏÉèÖÃĬÈÏÖµ0£¬È·±£±íÖÐnumÁÐûÓÐnullÖµ£¬È»ºóÕâÑù²éѯ£º  
select id from t where num=0 &n ......

ÈçºÎÅäÖà SQL Server 2005 ÒÔÔÊÐíÔ¶³ÌÁ¬½Ó

½ñÌìÔÚÒ»¸öVPSÉϰ²×°sql2005£¬°²×°ºÃºó±¾µØÒ»Ö±Á¬½Ó²»ÉÏ
¼ò½é
ÔÚ³¢ÊÔ´ÓÔ¶³Ì¼ÆËã»úÁ¬½Óµ½ Microsoft SQL Server 2005 ʵÀýʱ£¬¿ÉÄÜ»á½ÓÊÕµ½´íÎóÏûÏ¢¡£ÔÚʹÓÃÈκγÌÐòÁ¬½Óµ½ SQL Server ʱ¶¼¿ÉÄܻᷢÉú´ËÎÊÌâ¡£ÀýÈ磬ÔÚʹÓà SQLCMD ʵÓù¤¾ßÁ¬½Óµ½ SQL Server ʱÊÕµ½ÒÔÏ´íÎóÏûÏ¢£º
Sqlcmd:´íÎó:Microsoft SQL Native Cli ......

¼òµ¥µÄsqlÊý¾Ý¿â´¥·¢Æ÷ʵÀý

--ͨ¹ýsqlÆóÒµ¹ÜÀíÆ÷Ð޸ĺÍɾ³ýa±íÖÐÊý¾Ýʱ»á³öÏÖ´íÎó
--sqlÆóÒµ¹ÜÀíBug£¬Í¨¹ý³ÌÐò»òÖ´ÐÐsqlÓï¾ä¸üÐÂa±íÊý¾ÝûÓÐÎÊÌâ
--Ìí¼Ó
Insert a (FName, FCode, FOther) Values('11','2222','33')
--ÐÞ¸Ä
Update a Set FName='22_Edit' Where FCode='22'
--ɾ³ý
Delete a Where FCode='22'
--²é¿´a/b±íÊý¾Ý
Select * from a ......

SQL ¼Ü¹¹

¼Ü¹¹£¨Schema£©¡£Î¢ÈíµÄ¹Ù·½ËµÃ÷£¨MSDN£©£º
"Êý¾Ý¿â¼Ü¹¹ÊÇÒ»¸ö¶ÀÁ¢ÓÚÊý¾Ý¿âÓû§µÄ·ÇÖØ¸´ÃüÃû¿Õ¼ä£¬Äú¿ÉÒÔ½«¼Ü¹¹ÊÓΪ¶ÔÏóµÄÈÝÆ÷"£¬Ïêϸ²Î¿¼
http://technet.microsoft.com/zh-cn/library/ms190387.aspx.ÎÒÃÇÖªµÀ£¬ÔÚJAVAÖУ¬ÃüÃû¿Õ
¼äÃûÆäʵ¾ÍÊÇÎļþ¼ÐÃû¡£Òò´ËÎÒÃǷdz£Ã÷È·Ò»µã£ºÒ»¸ö¶ÔÏóÖ»ÄÜÊôÓÚÒ»¸ö¼Ü¹¹£¬¾ÍÏ ......

SQL Pivot & UnPivot

create table students (
  name varchar(25),
  class varchar(25),
  grade int
)
insert into students values ('ÕÅÈý','ÓïÎÄ',20)
insert into students values ('ÕÅÈý','Êýѧ',90)
insert into students values ('ÕÅÈý','Ó¢Óï',50)
insert into students values ('ÀîËÄ','ÓïÎÄ',81)
insert in ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ