C#ÖÐÓÃÓÚÁ¬½ÓSQLÊý¾Ý¿âµÄSQLHelperÀà
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient; //ÒýÓÃÃüÃû¿Õ¼ä
namespace DAL
{
/*******************************************************************************
* Name: SQLHelper
* File: SQLHelper.cs
* Description: ÓÃÓÚÍê³É¶ÔÊý¾Ý¿âµÄÏà¹Ø²Ù×÷
* Author: Ñ©ÀÇ
* DateTime: 2010Äê05ÔÂ13ÈÕ
*******************************************************************************/
public class SQLHelper
{
//ÉèÖÃÁ¬½Ó×Ö·û´® —— SQL ServerÑé֤ģʽµÄÁ¬½Ó×Ö·û´®
//public static string strConn = @"server = PANLING;database = StudentMIS;uid = sa;pwd = sa";
//ÉèÖÃÁ¬½Ó×Ö·û´® —— WindowsÑé֤ģʽµÄÁ¬½Ó×Ö·û´®
public static string strConn = @"server = T403-004\HB_SQLSERVER;database = DB_LibraryManage;Integrated Security = SSPI";
/// <summary>
/// ¹¦ÄÜÃèÊö£ºÖ´ÐÐADO.NETÔö¡¢É¾¡¢¸Ä²Ù×÷
/// </summary>
/// <param name="strText">ÊäÈë²ÎÊý —— ÒªÖ´ÐеÄSQLÓï¾ä(ÃüÁîÎı¾)</param>
/// <param name="cmdType">ÊäÈë²ÎÊý —— ÒªÖ´ÐеÄSQLÃüÁîÀàÐÍ</param>
/// <param name="SqlParams">ÊäÈë²ÎÊý —— ÒªÖ´ÐеÄSQLÓï¾äÖеIJÎÊýÁбí(ÃüÁî²ÎÊýÁбí)</param>
/// <returns>·µ»ØÖ´ÐÐÓ°ÏìµÄÐÐÊý</returns>
public static int MyExecu
Ïà¹ØÎĵµ£º
C#Éú³Écom×é¼þ£¬¹©aspµ÷ÓÃ
Ò»¡¢vs2005—н¨ÏîÄ¿—C#Àà¿â
Àà¿âÔ´ÂëÈçÏÂ(°üº¬½Ó¿Ú£¬À࣬ʼþ½Ó¿Ú)£º
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
namespace entryclass
{
  ......
select upper(name) from syscolumns
where id =any
(
select Id from sysobjects where name='tb_city'
)
lower
select row_number() over(order by firmid) from dbo.tb_BuildingMaterial
Éú³É ×ÔÔö 123
select rank() over(order by firmid) from dbo.tb_BuildingMaterial
Éú³É×ÔÔö123 ¸ù¾ÝÅ ......
Ò»¡¢¼òµ¥²éѯ
¡¡¡¡ ¼òµ¥µÄTransact-SQL²éѯֻ°üÀ¨Ñ¡ÔñÁÐ±í¡¢from×Ó¾äºÍWHERE×Ӿ䡣
ËüÃÇ·Ö±ð˵Ã÷Ëù²éѯÁС¢²éѯµÄ
±í»òÊÓͼ¡¢ÒÔ¼°ËÑË÷Ìõ¼þµÈ¡£
ÀýÈ磬ÏÂÃæµÄÓï¾ä²éѯtesttable±íÖÐÐÕÃûΪ“ÕÅÈý”µÄnickname×ֶκÍemail×ֶΡ£
SELECT nickname,email
from testtable WHERE name='ÕÅÈý'
(Ò»)Ñ¡ÔñÁбí
¡ ......
1. ³ÌÐòÈçÏ£º
string str = "Create Database " + "DBname";
string con = "Data Source=10.0.0.249\\sql2005;Initial Catalog=master;Persist Security Info=True;User ID=sa;Password=sa";
&n ......
²»Åç¿ÚË®!Ö±½ÓÉÏͼ
1.Êý¾Ý¿â¶ÔÏó¼ìË÷¹¦ÄÜ
2.T-SQLÓï·¨°ïÖú
3.³£Óú¯Êý°ïÖú(²»¶®ÄñÓï?13×Ô¼ºÁ·Á·°É!)
Download Now
°²×°Á÷³Ì:
1.ÏȰÑÍøÂçßDzæÁË(¶ÏÍø - -!!)
2.°ÑËùÓеÄSQL Server,VS¶¼¹ØÁË,ÔËÐÐSQLPrompt 4.0.exe°²×°
3.°²×°Íê±Ïºó,Í˳öRedGate.SQLPrompt.TrayApp ......