Guest Fabíola Posted January 25, 2005 Report Share Posted January 25, 2005 Pessoal, seguinte.. Onde trabalho, usamos o sql server, porém, eu tenho uma página que conforme serão cadastrados novos dados preciso atualizar ( insert ) uma outra base db2. alguém sabe como fazer isso??? Quote Link to comment Share on other sites More sharing options...
0 Guest Marcella Posted January 25, 2005 Report Share Posted January 25, 2005 Stored Procedure CREATE PROCEDURE SetGroupEntity @Name nvarchar(30) , @Description nvarchar(50) =NULL, @flag int OUTPUT AS IF EXISTS(SELECT * FROM GroupEntity WHERE NAME=@NAME) BEGIN SET @flag=1 return @flag END ELSE BEGIN INSERT INTO GroupEntity([Name], [Description], LastUpdatedDate) VALUES (@Name, @Description, CURRENT_TIMESTAMP) Set @flag=0 return @flag END VB Functions con = New SqlConnection(ConfigurationSettings.AppSettings("conBank")) con.Open() cmd = New SqlCommand cmd.Connection = con cmd.CommandType = CommandType.StoredProcedure cmd.CommandText = "SetGroupEntity" With cmd.Parameters .Add("@Name", iName) .Add("@Description", iDescription) .Add("@flag", SqlDbType.Int) 'parameter return from stored procedure End With cmd.Parameters("@Name").Direction = ParameterDirection.Input cmd.Parameters("@Description").Direction = ParameterDirection.Input cmd.Parameters("@flag").Direction = ParameterDirection.Output cmd.ExecuteNonQuery() iFlag = cmd.Parameters("@flag").Value 'get return value cmd.Dispose() con.Close() con.Dispose() Quote Link to comment Share on other sites More sharing options...
Question
Guest Fabíola
Pessoal, seguinte..
Onde trabalho, usamos o sql server, porém, eu tenho uma página que conforme serão cadastrados novos dados preciso atualizar ( insert ) uma outra base db2. alguém sabe como fazer isso???
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.