C#ÓëSQL Server 2000ʵÏÖÎÞÏÞ¼¶²Ëµ¥
//tree.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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.SqlClient;
using System.Threading;
public partial class MenuTree : System.Web.UI.Page
{
SqlDataAdapter da = null;
SqlConnection con = new SqlConnection("server=test;database=DQYPSite_oa;uid=sa;pwd=mfeilgm");
int i = 0;
int count = 0;
int proID = 0;
int column = 0;
string nextClassParentID;
string nextnode;
ArrayList columD = new ArrayList();
DataSet TreeTable = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string cmdStr = "select * from YP_FileClass order by ClassID";
da = new SqlDataAdapter(cmdStr, con);
da.Fill(TreeTable,"ClassForlder");
this.count = TreeTable.Tables["ClassForlder"].Rows.Count;
if (this.count > 0)
{
CreatNode(i);
}
els
Ïà¹ØÎĵµ£º
1¡¢join
A±íµÄÖ÷¼üÊÇ×÷ΪB±íµÄÍâ¼ü¡£ÔÚ²éѯµÄʱºò£¬¿ÉÒÔͨ¹ý²»Í¬µÄjoin½«AºÍB±íÁ´½ÓÆðÀ´£¬´Ó¶øµÃµ½²»Í¬µÄ²éѯ½á¹û¡£
* JOIN: Èç¹û±íÖÐÓÐÖÁÉÙÒ»¸öÆ¥Å䣬Ôò·µ»ØÐÐ
* INNER JOIN: Èç¹ûÁ½¸ö±íÖÐÓÐÆ¥ÅäµÄ£¬Ôò·µ»ØÐÐ
* LEFT JOIN: ¼´Ê¹ÓÒ±íÖÐûÓÐÆ¥Å䣬Ҳ´Ó×ó± ......
FileUp.aspx Ò³Ãæ
1<%@ Page language="c#" Codebehind="FileUp.aspx.cs" AutoEventWireup="false" Inherits="TestCenter.FileUp" %>
2<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
3<HTML>
4 <HEAD>
5 &l ......
SQL like×Ó¾äµÄÁíÒ»ÖÖʵÏÖ·½·¨,ËٶȱÈlike¿ì(ת)
Ò»°ãÀ´ËµÊ¹ÓÃÄ£ºý²éѯ£¬´ó¼Ò¶¼»áÏëµ½LIKE
select * from table where a like '%×Ö·û%'
Èç¹ûÒ»¸öSQLÓï¾äÖÐÓöà¸ö likeÄ£ºý²éѯ£¬²¢ÇҼǼÌõÊýºÜ´ó£¬ÄÇËÙ¶ÈÒ»¶¨»áºÜÂý¡£
ÏÂÃæÁ½ÖÖ·½·¨Ò²¿ÉʵÏÖÄ£ºý²éѯ£º
select * from table where patindex('%×Ö·û%',a)>0 ......
½ñÌìÔÚÒ»¸öVPSÉϰ²×°sql2005£¬°²×°ºÃºó±¾µØÒ»Ö±Á¬½Ó²»ÉÏ
¼ò½é
ÔÚ³¢ÊÔ´ÓÔ¶³Ì¼ÆËã»úÁ¬½Óµ½ Microsoft SQL Server 2005 ʵÀýʱ£¬¿ÉÄÜ»á½ÓÊÕµ½´íÎóÏûÏ¢¡£ÔÚʹÓÃÈκγÌÐòÁ¬½Óµ½ SQL Server ʱ¶¼¿ÉÄܻᷢÉú´ËÎÊÌâ¡£ÀýÈ磬ÔÚʹÓà SQLCMD ʵÓù¤¾ßÁ¬½Óµ½ SQL Server ʱÊÕµ½ÒÔÏ´íÎóÏûÏ¢£º
Sqlcmd:´íÎó:Microsoft SQL Native Cli ......
½ñÌìºÜ×ÔÈ»µÄÔÚдSqlÓï¾äµÄʱºòÓÃÁËTop£¬Ò»¿ªÊ¼Ã»·¢ÏÖÎÊÌ⣬ÒòΪÎÒ´ÓÊý¾Ý¿â¶Á³öµÄÖµÕýºÃÊÇ0£¬¶øÎÒϰ¹ß±äÁ¿¶¨ÒåµÄʱºòÒ²¶¼¸³Öµ0£¬¿ÉÊǵ½ÎÒ²»Òª0µÄʱºòÎҾͷ¢ÏÖÎÊÌâÁË¡£ºóÀ´²ÅÖªµÀ£¬¿É°®µÄСsqlite¾¹È»Óв»Ö§³ÖµÄsqlÓï·¨¡£
¡¡¡¡¿´µ½Ä³¸öÂÛ̳ÓиöÐÂÊÖÒ²·¢ÏÖÁËÕâ¸öÎÊÌâ²¢·¢ÌûÁË£¬ÏÂÃæÒ»Å£È˵Ļظ´ÊÇ“topÊÇÄļҵĹؼü´Ê?s ......