P
Patrick Olurotimi Ige
Can anybody tell me what i'm doing wrong?
The data is inserting 2 records at a time!!!
Thanks
Dim conn As SqlConnection
Dim cmdcommand As SqlCommand
Dim param As SqlParameter
Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
conn = New
SqlConnection("server=(local);database=Wintergreen;integrated
security=true;")
conn.Open()
txtuser.ID = Request.ServerVariables("LOGON_USER")
cmdcommand = New SqlCommand("rote", conn)
cmdcommand.CommandType = CommandType.StoredProcedure
param = cmdcommand.Parameters.Add("ReturnValue", SqlDbType.Int)
param.Direction = ParameterDirection.ReturnValue
cmdcommand.Parameters.Add("@username", txtuser.Name)
cmdcommand.ExecuteNonQuery()
Label1.Text = "Thanks for filling Crazy John's Survey!"
conn.Close()
End Sub
Sprocedure
-----------
CREATE PROCEDURE rote
(@username varchar(50))
AS
INSERT INTO survey
(username,DateCreated)
VALUES (@username,getdate())
GO
The data is inserting 2 records at a time!!!
Thanks
Dim conn As SqlConnection
Dim cmdcommand As SqlCommand
Dim param As SqlParameter
Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
conn = New
SqlConnection("server=(local);database=Wintergreen;integrated
security=true;")
conn.Open()
txtuser.ID = Request.ServerVariables("LOGON_USER")
cmdcommand = New SqlCommand("rote", conn)
cmdcommand.CommandType = CommandType.StoredProcedure
param = cmdcommand.Parameters.Add("ReturnValue", SqlDbType.Int)
param.Direction = ParameterDirection.ReturnValue
cmdcommand.Parameters.Add("@username", txtuser.Name)
cmdcommand.ExecuteNonQuery()
Label1.Text = "Thanks for filling Crazy John's Survey!"
conn.Close()
End Sub
Sprocedure
-----------
CREATE PROCEDURE rote
(@username varchar(50))
AS
INSERT INTO survey
(username,DateCreated)
VALUES (@username,getdate())
GO