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

C#Á¬½ÓAccessºÍSQL ServerÊý¾Ý¿â

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Str
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
/*
* connect to Sql Server
*/
string strConnection = "Data Source=ZRQ-PC;";
strConnection+="Initial Catalog=master;Integrated Security=True";
SqlConnection objConnection = new SqlConnection(strConnection);
objConnection.Open();
objConnection.Close();
/**************************************************************/
/*
* connect to access table
*/
//string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";
//strConnection += @"Data Source=C:\Users\ZRQ\Documents\STU.accdb";
//OleDbConnection objConnection = new OleDbConnection(strConnection);
//objConnection.Open();
//objConnection.Close();
/**************************************************************/
/*
*as for connect to Oracle or MySql µÈÎÒѧÁËÔÙ˵°É……(*^__^*)
*/
}
}
}
ÆäÖеļòÒ×°ì·¨£º
ÔÚ“·þÎñÆ÷×ÊÔ´¹ÜÀíÆ÷”ÖÐÑ¡ÔñÒªÁ¬½ÓµÄÊý¾Ý£¬then¿´ËüµÄÊôÐÔÖÐName£¬copy to strConnection ¼´¿É~


Ïà¹ØÎĵµ£º

ÊéдSQLʱҲ»ñµÃÖÇÄÜÌáʾ

дSQLµÄ±Èд.NET³ÌÐòµÄÌåÑéÉϲîÒ»µÈ£¬Ã»ÓÐÖÇÄÜÌáʾ£¬ÐèÒª¼Çס¹Ø¼ü×Ö£¬º¯Êý»òÕß²»¶ÏµØCopy±í×Ö¶ÎÃû£¬×Ô¶¨Ò庯Êý£¬´æ´¢¹ý³ÌÖ®ÀàµÄ¡£²»¹ýÔÚ
VS2010ÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃÖÇÄÜÌáʾÁË£¬ÈçÏÂÃ漸·ùͼËùʾ£º

Ôڱ༭Æ÷ÖУ¬ ÊäÈë Shift + J
£¨Ìáʾ£º VS2010 ¿ª·¢¹¤¾ßÖбêµÄÊÇ Ctrl +J ÆäʵӦ¸ÃÊÇ Shift + J £©¾Í¿ÉÒÔ×Ô¶¯´ò¿ªÕâ¸öÖÇ ......

sqlÉú³É½Å±¾ÀïSET ANSI_NULLS ONʲôÒâ˼

±¾ÎÄÀ´×Ô£ºhttp://zhidao.baidu.com/question/27978123.html?si=1
ÕâЩÊÇ SQL-92 ÉèÖÃÓï¾ä£¬Ê¹ SQL Server 2000/2005 ×ñ´Ó SQL-92 ¹æÔò¡£
µ± SET QUOTED_IDENTIFIER Ϊ ON ʱ£¬±êʶ·û¿ÉÒÔÓÉË«ÒýºÅ·Ö¸ô£¬¶øÎÄ×Ö±ØÐëÓɵ¥ÒýºÅ·Ö¸ô¡£µ± SET QUOTED_IDENTIFIER Ϊ OFF ʱ£¬±êʶ·û²»¿É¼ÓÒýºÅ£¬ÇÒ±ØÐë·ûºÏËùÓÐ Transact-SQL ±êÊ ......

SQL server×Ó²éѯ

exec xp_cmdshell 'md E:\project'
--ÏÈÅжÏÊý¾Ý¿âÊÇ·ñ´æÔÚÈç¹û´æÔÚ¾Íɾ³ý
if exists(select * from sysdatabases where name='bbsDB')
drop database bbsDB
--´´½¨Êý¾Ý¿âÎļþ
create database bbsDB
--Ö÷Êý¾Ý¿âÎļþ
 on primary
(
 name='bbsDB_data',--ΪÖ÷ÒªÊý¾Ý¿âÎļþÃüÃû
 filename='E:\proj ......

SQLÀïµÄÖ÷¼üºÍÍâ¼ü

Õâ¸öÂß¼­¹Øϵէ¿´ÆðÀ´±È½Ï¸´ÔÓ£¬ÅªÇå³þÁ˾ͺã¡
ÓÐÁ½¸ö±í£¬
student(
id,
name,
primary key (id)
);
studentInfo(
id,
age,
address,
foreign key(id) references outTable(id) on delete cascade on update cascade
);
µ±ÎÒÃÇɾ³ýstudent±íµÄʱºò×ÔȻϣÍûstudentInfoÀïµÄÏà¹ØÐÅÏ¢Ò²±»É¾³ý£¬Õâ¾ÍÊÇÍâ¼üÆð×÷Óà ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ