.netѧϰ×ܽᣨ6£©Ö®sqlserver ×Ô¶¨Ò庯ÊýÓë´æ´¢¹ý³Ì
21 Ò»¸öSQLServerµÄ×Ô¶¨Ò庯ÊýÖе÷ÓÃÒ»¸ö×Ô¶¨ÒåµÄ´æ´¢¹ý³Ì£¬Ö´Ðд˺¯Êýºó·¢³öÈçÏÂÌáʾ£º“Ö»Óк¯ÊýºÍÀ©Õ¹´æ´¢¹ý³Ì²ÅÄÜ´Óº¯ÊýÄÚ²¿Ö´ÐÐ"¡£
ÔÒò£ºº¯ÊýÖ»ÄÜʹÓüòµ¥µÄsqlÓï¾ä,Âß¼¿ØÖÆÓï¾ä£¬¸´ÔÓÒ»µãµÄ´æ´¢¹ý³ÌÊDz»Äܵ÷Óõģ¬ÔÚº¯ÊýÀïÒ²²»ÄÜʹÓÃexecute sp_executesql »òÕßexecute ¡£½â¾ö·½·¨°Ñº¯Êý¸ÄΪ´æ´¢¹ý³Ì£¬È»ºóÔÚÁíÒ»¸ö´æ´¢¹ý³ÌÖÐÏóµ÷Óú¯ÊýÒ»ÑùʹÓô˴洢¹ý³Ì¾Í¿ÉÒÔÁË¡£
ÏÂÃæÊÇÒ»¸ö´æ´¢¹ý³Ìµ÷ÓÃÁíÒ»¸ö´æ´¢¹ý³ÌµÄʵÀý£¬ÓвÎÊý´«µÝµÄ¡£
--´æ´¢¹ý³Ìsp_B
create proc sp_B
@A int ,
@B int ,
@C int output
AS
set @C = @A + @B
go
--´æ´¢¹ý³Ìp_A
create proc sp_A
@A int ,
@B int
as
declare @C int
exec sp_B @A , @B , @C output
print @C
go
--²âÊÔ
exec sp_A 3 , 5
22. ÔõÑùÖ´Ðдø²ÎÊýµÄSQLÓï¾ä£¬±ÈÈç˵×Ö¶ÎÊÇÒ»¸ö²ÎÊý£¬ÈçºÎд´æ´¢¹ý³Ì£¿ÊµÀýÈçÏ£º
Create proc [dbo].[jsxs]
(
@zb varchar(5),
@nr varchar(4),
@ID int,
@shu int output
)
AS
BEGIN
declare @sqls nvarchar(1000)--×¢Òâ´ËÀàÐÍ
if @nr='A'
set @zb=@zb+'1'
if @nr='B'
set @zb=@zb+'2'
if @nr='C'
set @zb=@zb+'3'
if @nr='D'
set @zb=@zb+'4'
if @nr='E'
set @zb=@zb+'5'
----------------------------------Ö÷Ìⲿ·Ö------------------------------------
set @sqls='select @a=' +@zb + ' from shumu where peID=' +cast(@ID as char)
exec sp_executesql
@sqls,
N'@a int output',@sh
Ïà¹ØÎĵµ£º
½ñÌìÔÚÍøÉÏÕÒÁËÐí¾Ã¹ØÓÚsqlserverÖд洢imageÀàÐͺͶÁÈ¡imageµÄ·½·¨£¬¿ÉÊǶ¼ÊÇÄÇôһµã£¬¹ÊÔÚ´ËÂÞÁÐһϣ¬Ï£Íû¿ÉÒÔ°ïÖú´ó¼Ò¡£
Ê×ÏÈÊǹØÓÚdataGridViewµÄ°ó¶¨¡£´úÂë¼ûÏÂ
private void button_show_Click(object sender, EventArgs e)
{
string sqlText = "server=localhost;initial catalog=Test; ......
Õâ¸öÊÇÎÒ¼ÓÈëµÄQQȺÀïÃæÒ»¸öÍøÓÑÎʵÄÎÊÌâ¡£Ëû˵һ¸ö±í×öÒ»¸öINSERT¶¼»á³¬Ê±¡£ÕýÀ§»óÄØ£¬ÏòȺÀïÃæµÄÈËÇóÖú¡£ÎҸպöÔÕâ·½ÃæÖªµÀµã£¬¾Í»Ø´ðÁË˵ҪÓÅ»¯¾Û¼¯Ë÷Òý¡£Ëû²»Ã÷°×¾ßÌå¸ÃÔõô×ö£¬ËƺõÒ²²»ÖªµÀʲôÊǾۼ¯Ë÷Òý¡£ÎÒ¶ÔËû˵Äã¿ÉÒÔ¿´¿´Äã²åÈë¼Ç¼ʱµÄ´ÅÅÌIOÊÇ·ñ±È½Ï¶à£¬Ëû˵ËûµÄ´ÅÅÌÒѾ»»³ÉÁËRAID£¬²»ºÃ²é¿´´ÅÅÌIO¡£OK, ÎÒ¼Ì ......
¼Ç¼һÏÂÒÔ±¸Ï´οìËÙÕÒµ½¡£¡£¡£
Íùtb_wf_privgrant±íÖвåÈëÒ»Ìõ¼Ç¼£¬workflow_id×Ö¶ÎÖµ´Ótb_wf_workflow ±íÖлñÈ¡workflow_name='֪ʶÉóºË'µÄËùÓмǼÖÐworkflow_id×î´óÖµ¡£
--oracle
declare a NUMBER(10);
begin
select max(wo ......
µ±ÔÚC#ÓïÑÔÖУ¬Á¬½ÓsqlÊý¾Ý¿âµÄʱºò£¬³£Óõ½sqlconnection½¨Á¢ÓëÊý¾Ý¿âµÄÁ¬½Ó¡£ Óï·¨ÈçÏ£º
String sqlcon = "***";//ÕâÀïÊÇÒ»¸ö×Ö·û´®£¬¾ßÌå¸úÊý¾Ý¿âµÄÑéÖ¤·½Ê½Óйء£
//sql server Éí·ÝÑéÖ¤ Á¬½Ó×Ö·û´®
private string ConnstrSqlServer = "server=·þÎñÆ÷Ãû³ ......