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

¸½¼Ósql server 20005Êý¾Ý¿â

·½·¨Ò»£º
1.Èç¹û¸½¼ÓÊý¾Ý¿âʱ£¬Ã»ÓÐÖ¸¶¨Âß¼­Ãû£¬ÔòÔÚSQL2005ÉÏÏÔʾΪ“ȫ·¾¶£¬ÇÒΪ´óд”¡£±ÈÈ磬Êý¾Ý¿âÎļþD:MyTest.mdfºÍD:MyTest.ldf£¬¸½¼Óµ½SQL·þÎñÆ÷ÉÏʱ£¬Èç¹ûûÓÐÖ¸¶¨Âß¼­Ãû£¬ÔòÔÚSQL2005ÉÏÏÔʾΪ“D:MYTEST.MDF”¡£´Ëʱ£¬C#µÄÁ¬½Ó×Ö·û´®Îª“DataSource=dsName;AttatchDBFilename=”D:\MyTest.mdf”;User ID=id;Password=pw”£»
2.Èç¹û¸½¼ÓÊý¾Ý¿âʱ£¬Ö¸¶¨ÁËÂß¼­Ãû£¬ÔòÔÚSQL2005ÉÏÏÔʾΪ“Âß¼­Ãû”£¬´Ëʱ£¬C#µÄÁ¬½Ó×Ö·û´®Îª“DataSource=dsName;AttatchDBFilename=”D:\MyTest.mdf”;Initial Catalog=aa_LogicName;User ID=id;Password=pw”£»
3.±»¸½¼ÓµÄÊý¾Ý¿âÃû³Æ²»¿ÉËæÒâ¸ü¸Ä£»·ñÔòÈÝÒ׳öÏÖ´íÎó¡£
·½·¨¶þ£º
string DbPath=System.Environment.CurrentDirectory +@"\Demo_Data.MDF";
string LogPath=System.Environment.CurrentDirectory +@"\Demo_Log.LDF";
string StrSql="exec sp_attach_db @dbname='supmark',@filename1='"+DbPath+"',@filename2='"+LogPath+"'";
string strcon="Server=(local);Integrated Security=SSPI;Database=master";
SqlConnection cn=new SqlConnection(strcon);
SqlCommand cmd =new SqlCommand (StrSql,cn);
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
·½·¨ÈýÏêϸ´úÂ룺
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Data;
using System.ServiceProcess;
namespace AdminZJC.DataBaseControl
{
/// <summary>
/// Êý¾Ý¿â²Ù×÷¿ØÖÆÀà
/// </summary>
public class DataBaseControl
{
/// <summary>
/// Êý¾Ý¿âÁ¬½Ó×Ö·û´®
/// </summary>
public string ConnectionString;
/// <summary>
/// SQL²Ù×÷Óï¾ä/´æ´¢¹ý³Ì
/// </summary>
public string StrSQL;
/// <summary>
/// ʵÀý»¯Ò»¸öÊý¾Ý¿âÁ¬½Ó¶ÔÏó
/// </summary>
private SqlConnection Conn;
/// <summary>
/// ʵÀý»¯Ò»¸öеÄÊý¾Ý¿â²Ù×÷¶ÔÏóComm
/// </summary>
private SqlCommand Comm;
/// <summary>
/// Òª²Ù×÷µÄÊý¾Ý¿âÃû³Æ
/// </summary>
public string DataBaseName;
/// <summary>
/// Êý¾Ý¿âÎļþÍêÕûµØÖ


Ïà¹ØÎĵµ£º

Oracle SQL*PlusµÄ»·¾³ÅäÖ㨸ü¸ÄÐÐ¿í£©

µ±ÎÒÃÇÓÃoracleµÄSQL*Plus¹¤¾ßÊäÈësqlÓï¾äµÄʱºò£¬SQL*PlusµÄĬÈÏÉèÖÃ×ÜÓÐЩ²»ºÏÀíµÄµØ·½£¬´ËʱÎÒÃÇͨ¹ýÒÔÏÂһЩ·½·¨¸Ä½ø£º
1¡¢¿ÉÒÔÔËÓÃSQL*Plus×ÔÉíһЩÓï¾ä¸Ä±ä»·¾³²ÎÊý¡£
     SQL>  set linesize 900 ;   /* ¸ü¸ÄÏÔʾµÄ¿í¶È, ÉèÖóÉ900ºó, Ò»ÐÐÊý¾Ý¾Í²»»á·ÖÁ½ÐÐÏÔʾÁË */
&nb ......

ʹÓÃTRY/CATCHÓï¾ä½â¾öSQL Server 2005ËÀËø

      ÈÃÎÒÃÇ´ÓÕâÑùÒ»¸öʾÀý¿ªÊ¼ËµÆð£¬ËüÔÚ SQL Server 2000 ºÍ 2005 Öж¼ÄÜÒýÆðËÀËø¡£ÔÚ±¾ÎÄÖУ¬ÎÒʹÓà SQL Server 2005 µÄ×îРCTP£¨ÉçÇø¼¼ÊõÔ¤ÀÀ£¬Community Technology Preview£©°æ±¾£¬SQL Server 2005 Beta 2£¨7 Ô·¢²¼£©Ò²Í¬ÑùÊÊÓá£Èç¹ûÄúûÓÐ Beta 2 »ò×îÐ嵀 CTP °æ±¾£¬ÇëÏÂÔØ SQL Serve ......

×ܽáÒ»ÏÂdelphiÖÐSQLÓï¾äÖÐÒýºÅ

×ܽáÒ»ÏÂSQLÓï¾äÖÐÒýºÅ(')¡¢quotedstr()¡¢('')¡¢format()ÔÚSQLÓï¾äÖеÄÓ÷¨ÒÔ¼°SQLÓï¾äÖÐÈÕÆÚ¸ñʽµÄ±íʾ(#)¡¢('')
ÔÚDelphiÖнøÐÐ×Ö·û±äÁ¿Á¬½ÓÏà¼Óʱµ¥ÒýºÅÓÃ('''),ÓÖÒýºÅÓÃ('''')±íʾ
Ê×Ïȶ¨Òå±äÁ¿
var
AnInt:integer=123;//ΪÁË·½±ãÔڴ˶¼¸øËüÃǸ³³õÖµ¡£ËäÈ»¿ÉÄÜÔÚÒý¸³³õÖµÔÚijЩÇé¿öϲ»¶Ô
AnIntStr:string='456'; ......

¶¯Ì¬´´½¨Sql ServerÊý¾Ý¿âÏà¹Ø£¨È«£©

 
CREATE DATABASE
´´½¨Ò»¸öÐÂÊý¾Ý¿â¼°´æ´¢¸ÃÊý¾Ý¿âµÄÎļþ£¬»ò´ÓÏÈÇ°´´½¨µÄÊý¾Ý¿âµÄÎļþÖи½¼ÓÊý¾Ý¿â¡£
˵Ã÷ ÓйØÓë DISK INIT Ïòºó¼æÈÝÐԵĸü¶àÐÅÏ¢£¬Çë²Î¼û"Microsoft® SQL Server™ Ïòºó¼æÈÝÐÔÏêϸÐÅÏ¢"ÖеÄÉ豸£¨¼¶±ð 3£©¡£
Óï·¨
CREATE DATABASE database_name
[ ON
[ < filespec > ......

ORACLE PL/SQL¿ª·¢

¸Õ¸ÕÔÚinthirtiesÀÏ´óµÄ²©¿ÍÀï¿´µ½ÕâƪÎÄÕ£¬Ð´µÄ²»´í£¬ÕýºÃ×Ô¼º×î½üÔÚѧϰPL/SQL£¬×ª¹ýÀ´Ñ§Ï°Ñ§Ï°¡£
==================================================================================
bulk collectÊÇ¿ÉÒÔ¿´×öÊÇÒ»ÖÖÅú»ñÈ¡µÄ·½Ê½£¬ÔÚÎÒÃǵÄplsqlµÄ´úÂë¶ÎÀï¾­³£×÷ΪintoµÄÀ©Õ¹À´Ê¹Ó᣶ÔÓÚselect id into v from ... ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ