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

ASP³ÌÐòÓëSQL´æ´¢¹ý³Ì½áºÏʹÓÃÏê½â

´æ´¢½ø³Ì¾ÍÊÇ×÷Ϊ¿ÉÖ´ÐжÔÏó´æ·ÅÔÚÊý¾Ý¿âÖеÄÒ»¸ö»ò¶à¸öSQLÃüÁî¡£
¶¨Òå×ÜÊǺܳéÏó¡£´æ´¢½ø³ÌÆäʵ¾ÍÊÇÄÜÍê³ÉÒ»¶¨²Ù×÷µÄÒ»×éSQLÓï¾ä£¬Ö»²»¹ýÕâ×éÓï¾äÊÇ·ÅÔÚÊý¾Ý¿âÖеÄ(ÕâÀïÎÒÃÇ̸ֻSQL SERVER)¡£Èç¹ûÎÒÃÇͨ¹ý´´½¨´æ´¢½ø³ÌÒÔ¼°ÔÚASPÖе÷Óô洢½ø³Ì£¬¾Í¿ÉÒÔ±ÜÃ⽫SQLÓï¾äͬASP´úÂë»ìÔÓÔÚÒ»Æð¡£ÕâÑù×öµÄºÃ´¦ÖÁÉÙÓÐÈý¸ö£º
µÚÒ»¡¢´ó´óÌá¸ßЧÂÊ¡£´æ´¢½ø³Ì±¾ÉíµÄÖ´ÐÐËٶȷdz£¿ì£¬¶øÇÒ£¬µ÷Óô洢½ø³Ì¿ÉÒÔ´ó´ó¼õÉÙͬÊý¾Ý¿âµÄ½»»¥´ÎÊý¡£
µÚ¶þ¡¢Ìá¸ß°²È«ÐÔ¡£¼ÙÈ罫SQLÓï¾ä»ìºÏÔÚASP´úÂëÖУ¬Ò»µ©´úÂëʧÃÜ£¬Í¬Ê±Ò²¾ÍÒâζ×Å¿â½á¹¹Ê§ÃÜ¡£
µÚÈý¡¢ÓÐÀûÓÚSQLÓï¾äµÄÖØÓá£
ÔÚASPÖУ¬Ò»°ãͨ¹ýCOMMAND¶ÔÏóµ÷Óô洢½ø³Ì£¬¸ù¾Ý²»Í¬Çé¿ö£¬±¾ÎÄÒ²½éÉÜÆäËüµ÷Ó÷½·¨¡£ÎªÁË·½±ã˵Ã÷£¬¸ù¾Ý´æ´¢½ø³ÌµÄÊäÈëÊä³ö£¬×÷ÒÔϼòµ¥·ÖÀࣺ
1. Ö»·µ»Øµ¥Ò»¼Ç¼¼¯µÄ´æ´¢½ø³Ì
¼ÙÉèÓÐÒÔÏ´洢½ø³Ì(±¾ÎĵÄÄ¿µÄ²»ÔÚÓÚ½²ÊöT-SQLÓï·¨£¬ËùÒÔ´æ´¢½ø³ÌÖ»¸ø³ö´úÂ룬²»×÷˵Ã÷)£º
/*SP1*/
CREATE PROCEDURE DBO.GETUSERLIST
AS
SET NOCOUNT ON
BEGIN
SELECT * from DBO.[USERINFO]
END
GO
ÒÔÉÏ´æ´¢½ø³ÌÈ¡µÃUSERINFO±íÖеÄËùÓмǼ£¬·µ»ØÒ»¸ö¼Ç¼¼¯¡£Í¨¹ýCOMMAND¶ÔÏóµ÷Óøô洢½ø³ÌµÄASP´úÂëÈçÏÂ:
'**ͨ¹ýCOMMAND¶ÔÏóµ÷Óô洢½ø³Ì**
DIM MYCOMM,MYRST
SET MYCOMM = SERVER.CREATEOBJECT("ADODB.COMMAND")
MYCOMM.ACTIVECONNECTION = MYCONSTR 'MYCONSTRÊÇÊý¾Ý¿âÁ¬½Ó×Ö´®
MYCOMM.COMMANDTEXT = "GETUSERLIST" 'Ö¸¶¨´æ´¢½ø³ÌÃû
MYCOMM.COMMANDTYPE = 4 '±íÃ÷ÕâÊÇÒ»¸ö´æ´¢½ø³Ì
MYCOMM.PREPARED = TRUE 'ÒªÇó½«SQLÃüÁîÏÈÐбàÒë
SET MYRST = MYCOMM.EXECUTE
SET MYCOMM = NOTHING
´æ´¢½ø³ÌÈ¡µÃµÄ¼Ç¼¼¯¸³¸øMYRST£¬½ÓÏÂÀ´£¬¿ÉÒÔ¶ÔMYRST½øÐвÙ×÷¡£
ÔÚÒÔÉÏ´úÂëÖУ¬COMMANDTYPEÊôÐÔ±íÃ÷ÇëÇóµÄÀàÐÍ£¬È¡Öµ¼°ËµÃ÷ÈçÏ£º
-1 ±íÃ÷COMMANDTEXT²ÎÊýµÄÀàÐÍÎÞ·¨È·¶¨
1 ±íÃ÷COMMANDTEXTÊÇÒ»°ãµÄÃüÁîÀàÐÍ
2 ±íÃ÷COMMANDTEXT²ÎÊýÊÇÒ»¸ö¾ßÓеıíÃû³Æ
4 ±íÃ÷COMMANDTEXT²ÎÊýÊÇÒ»¸ö´æ´¢½ø³ÌµÄÃû³Æ
»¹¿ÉÒÔͨ¹ýCONNECTION¶ÔÏó»òRECORDSET¶ÔÏóµ÷Óô洢½ø³Ì£¬·½·¨·Ö±ðÈçÏ£º
'**ͨ¹ýCONNECTION¶ÔÏóµ÷Óô洢½ø³Ì**
DIM MYCONN,MYRST
SET MYCONN = SERVER.CREATEOBJECT("ADODB.CONNECTION")
MYCONN.OPEN MYCONSTR 'MYCONSTRÊÇÊý¾Ý¿âÁ¬½Ó×Ö´®
SET MYRST = MYCONN.EXECUTE("GETUSERLIST",0,4) '×îºóÒ»¸ö²Î¶Ïº¬ÒåͬCOMMANDTYPE
SET MYCONN = NOTHING
'**ͨ¹ýRECORDSET¶ÔÏóµ÷Óô洢½ø³Ì**
DIM MYRST
SET


Ïà¹ØÎĵµ£º

º½¿Õ¹«Ë¾¹ÜÀíϵͳ(VC++ ÓëSQL 2005)

ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
      ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......

ORACLEÖÐSQLÈ¡×îºóÒ»Ìõ¼Ç¼µÄ¼¸ÖÖ·½·¨

  ÔÚETL¹ý³ÌÖУ¬¾­³£»áÅöµ½È¡½á¹û¼¯µÄ×îºó»ò×îÇ°Ò»Ìõ¼Ç¼¡£ÈçÈ¡»îÆÚ´æ¿îµÄµ±Ç°ÀûÂÊ£¬¿ª»§½ð¶î£¬Ð­¶¨ÀûÂʵȡ£Èç¹û²»ÓÃLOOKUPµÄ·½Ê½£¬Èçͨ¹ýÓαêÈ¡»òÕßETL¹¤¾ßLOOKUP×é¼þʲôµÄ£¬ÔÚÒ»ÌõSQLÀïʵÏÖ£¬Ä¿Ç°ÊµÏÖÓм¸ÖÖ·½·¨¡£
1.ÒÔʱ¼ä»òÆäËû×ֶηÖ×éºóÔÚ×ÔÁ¬×Ô¼º£¬ÕâÑù²»½ö¿ÉÒÔ´ø³öÐèÒªLOOKUPµÄ×ֶΣ¬»¹¿ÉÒÔ´ø³öÆäËûÐèÒªµÄ×Ö ......

Sql ²éѯ¼¼ÇÉ Ä³Àý ¹ØÓÚinµÄÅÅÐò

  ÔÚÓÐʱºòʹÓÃinÓï¾ä²éѯµÄʱºò,inÓï¾äÖкܶàÏî,Èç15Ï×Ô¼ºÍ¬Ê±ÏëÈòéѯ³öÀ´½á¹ûÄܹ»°´ÕÕinÓï¾äÖиÃ×Ö¶Î˳Ðò²éѯ³öÀ´¡£
 ¶øSql ServerÊÇĬÈÏ°´ÕÕ×Ô¼ºµÄ˳ÐòÅÅÁгöÀ´µÄ£¬ËùÒÔÒ»¶¨»á°Ñ½á¹û¼¯ÖØÐÂÅÅÐòµÄ¡£
¶øÈç¹ûʹÓÃcase whenµÄ·½·¨ËäÈ»ºÜ·±Ëö£¬µ«Ò²ÊÇ¿ÉÒÔʵÏÖµÄ
 
 
select item_code,apply_dep ......

sql²Ù×÷

ÅжÏÁ¬½ÓÊý¾Ý¿â״̬£º
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Import Namespace= "System.Data.SqlClie ......

SQL ¸ßЧͨÓ÷ÖÒ³´æ´¢¹ý³Ì(Ë«Ïò¼ìË÷)

create PROC [dbo].[P_viewPage_A]
/*
¸ßЧͨÓ÷ÖÒ³´æ´¢¹ý³Ì(Ë«Ïò¼ìË÷)
¾´¸æ£ºÊÊÓÃÓÚµ¥Ò»Ö÷¼ü»ò´æÔÚΨһֵÁеıí»òÊÓͼ
ps:SqlÓï¾äΪ8000×Ö½Ú,µ÷ÓÃʱÇë×¢Òâ´«Èë²ÎÊý¼°sql×ܳ¤¶È²»Òª³¬¹ýÖ¸¶¨·¶Î§
*/
@TableName VARCHAR(200),     --±íÃû
@FieldList VARCHAR(2000),    --ÏÔʾÁÐà ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ