jerryeagle
01-18-2009, 05:59 AM
Hi, I'm making a VB Program to Manage a SQL Database, I made a Users Table and a Form to Manage this Table, I have a "New" Button (For adding a new row), a "Save" Button and a "Delete" Button, at first it seems to work but it's just "Temporally", I mean after I Run the Program a few times, the changes I made just go away, and the Table get back to the State before I made any changes, and whrn I make changes, I check the SQL Table but altought when I run the VB program, the Changes do Change the DATA, the SQL Table stays without any change!! I don't know what am I doing wrong!! This is the Code I use:
Insert Prodecdure:
ALTER PROCEDURE dbo.AgregaUserQuery
(
@Id nvarchar(20),
@Clave nvarchar(50),
@Tipo nvarchar(50),
@Fecha datetime
--@Modificado timestamp OUTPUT
)
AS
SET NOCOUNT ON;
INSERT INTO Usuarios
(Id, Clave, Tipo, Fecha)
VALUES (@Id,@Clave,@Tipo,@Fecha);
IF @@ROWCOUNT>0 AND @@ERROR = 0
SELECT @Id=Id
FROM Usuarios;
Delete Procedure:
ALTER PROCEDURE dbo.BorrarUserProcedure
(
@Id nvarchar(20)
)
AS
SET NOCOUNT ON;
DELETE FROM Usuarios Where (Id = @Id);
I have not wrote the UPDATE Procedure yet.
Anyone could help me please??
Thanks
Insert Prodecdure:
ALTER PROCEDURE dbo.AgregaUserQuery
(
@Id nvarchar(20),
@Clave nvarchar(50),
@Tipo nvarchar(50),
@Fecha datetime
--@Modificado timestamp OUTPUT
)
AS
SET NOCOUNT ON;
INSERT INTO Usuarios
(Id, Clave, Tipo, Fecha)
VALUES (@Id,@Clave,@Tipo,@Fecha);
IF @@ROWCOUNT>0 AND @@ERROR = 0
SELECT @Id=Id
FROM Usuarios;
Delete Procedure:
ALTER PROCEDURE dbo.BorrarUserProcedure
(
@Id nvarchar(20)
)
AS
SET NOCOUNT ON;
DELETE FROM Usuarios Where (Id = @Id);
I have not wrote the UPDATE Procedure yet.
Anyone could help me please??
Thanks