ADO.NETÖеÄsqlÁ¬½Ó
using System.Data; // Use ADO.NET namespace
using System.Data.SqlClient;
SqlConnection thisConnection = new SqlConnection(
@"Data Source=GY; Initial Catalog=northwind;uid=sa;password=datadog"); //ÏȽ¨Á¢Á¬½Ó
thisConnection.Open();//´ò¿ªÁ¬½Ó
SqlCommand thisCommand = thisConnection.CreateCommand();//Ö±½ÓÖ¸¶¨connµÄcommand
Ò²¿ÉÒÔÕâÑù // SqlCommand cmd = new SqlCommand();
// cmd.Connection = thisConnection;
cmmandµÄsqlÃüÁî
thisCommand.CommandText = "SELECT CustomerID, CompanyName from Customer";
SqlDataReader thisReader = thisCommand.ExecuteReader();//sqldatareader²»¿ÉÒÔÓÃnew ±ØÐëÖ±½ÓÓëcommand¹ØÁª
//ÓÃreader¶Á³ö±í
while (thisReader.Read())
{
// Output ID and name columns
Console.WriteLine("\t{0}\t{1}",
thisReader["CustomerID"], thisReader["CompanyName"]);
// Close reader ÓÃÍêÒª¹Ø±Õ
thisReader.Close();
Ïà¹ØÎĵµ£º
µÚÒ»´Î°²×°2005,»¨Á˲»ÉÙ¾«Á¦¡£ËäȻûʲô̫Äѵģ¬µ«ÊDz»ÖªµÀµÄ»°»áºÜ¼¬Êֵġ£Èç¹ûÄãÕýÔÚ°²×°£¬²¢ÇÒ·¢ÏÖÕâƪÎÄÕ£¬ÄÇôÄãºÜ×ßÔË£¬Ä㽫»á˳ÀûµÄ°²×°³É¹¦¡£
°²×°Ä¿Â¼Öаüº¬Sql Server x64 ºÍ x86, x86ÊÇ32λ»úÆ÷µÄ¡£x86ÖÐÓÖÓÐtools ºÍ Servers ¡£µÚÒ»´Î°²×°ÁËServers£¬È» ......
create PROC [dbo].[P_viewPage_A]
/*
¸ßЧͨÓ÷ÖÒ³´æ´¢¹ý³Ì(Ë«Ïò¼ìË÷)
¾´¸æ£ºÊÊÓÃÓÚµ¥Ò»Ö÷¼ü»ò´æÔÚΨһֵÁеıí»òÊÓͼ
ps:SqlÓï¾äΪ8000×Ö½Ú,µ÷ÓÃʱÇë×¢Òâ´«Èë²ÎÊý¼°sql×ܳ¤¶È²»Òª³¬¹ýÖ¸¶¨·¶Î§
*/
@TableName VARCHAR(200), --±íÃû
@FieldList VARCHAR(2000), --ÏÔʾÁÐà ......
¸üÐÂÏÂÎÊÌ⣺
񡜧TBL_Info
×ֶΣº
infoId int
title varchar(20)
Content text
byUser varchar(20)
createTime datetime
1¡¢ÈçºÎɾ³ý±íÖÐÊý¾ÝÏàͬµÄÊý¾ÝÄØ£¿£¨Ö÷¼ü³ýÍ⣩
2¡¢ÈçºÎɾ³ýÊý¾Ý±íÖÐij¸ö×Ö¶ÎÊý¾ÝÏàÍ ......
Ëæ×ÅB/SģʽӦÓÿª·¢µÄ·¢Õ¹£¬Ê¹ÓÃÕâÖÖģʽ±àдӦÓóÌÐòµÄ³ÌÐòÔ±Ò²Ô½À´Ô½¶à¡£µ«ÊÇÓÉÓÚ³ÌÐòÔ±µÄˮƽ¼°¾ÑéÒ²²Î²î²»Æ룬Ï൱´óÒ»²¿·Ö³ÌÐòÔ±ÔÚ±àд´úÂëµÄʱºò£¬Ã»ÓжÔÓû§ÊäÈëÊý¾ÝµÄºÏ·¨ÐÔ½øÐÐÅжϣ¬Ê¹Ó¦ÓóÌÐò´æÔÚ°²È«Òþ»¼¡£Óû§¿ÉÒÔÌá½»Ò»¶ÎÊý¾Ý¿â²éѯ´úÂ룬¸ù
¾Ý³ÌÐò·µ»ØµÄ½á¹û£¬»ñµÃijЩËûÏëµÃÖªµÄÊý¾Ý£¬Õâ¾ÍÊÇËùνµÄS ......
Ëæ×ÅB/SģʽӦÓÿª·¢µÄ·¢Õ¹£¬Ê¹ÓÃÕâÖÖģʽ±àдӦÓóÌÐòµÄ³ÌÐòÔ±Ò²Ô½À´Ô½¶à¡£µ«ÊÇÓÉÓÚÕâ¸öÐÐÒµµÄÈëÃÅÃż÷²»¸ß£¬³ÌÐòÔ±µÄˮƽ¼°¾ÑéÒ²²Î²î²»Æ룬Ï൱´óÒ»²¿·Ö³ÌÐòÔ±ÔÚ±àд´úÂëµÄʱºò£¬Ã»ÓжÔÓû§ÊäÈëÊý¾ÝµÄºÏ·¨ÐÔ½øÐÐÅжϣ¬Ê¹Ó¦ÓóÌÐò´æÔÚ°²È«Òþ»¼¡£Óû§¿ÉÒÔÌá½»Ò»¶ÎÊý¾Ý¿â²éѯ´úÂ룬¸ù¾Ý³ÌÐò·µ»ØµÄ½á¹û£¬»ñµÃijЩËûÏëµÃÖªµÄÊ ......