L
luna
got so far then it broke and i cant get it working again - it was updating
fine but not inserting and now im getting a "Error converting data type
varchar to numeric" which i didnt have before....
stored procedure is
CREATE Procedure newupdate
@newid varchar(50),
@newnews varchar(50)
AS
IF EXISTS (SELECT * FROM dbo.news WHERE ID =@newid)
UPDATE dbo.news SET news = @newnews WHERE Id =@newid
ELSE
INSERT into dbo.news (news) VALUES ("@newnews")
GO
which parses fine - so im guessing its the asp side of things
which is
Dim newid As String = TextBox1.Text.ToString
Dim newnews As String = TextBox2.Text.ToString
Dim strConn As String = "server=;uid=sa;pwd=;database=news"
Dim conn As New System.Data.SqlClient.SqlConnection(strConn)
Dim sql As String = "newupdate '" & newnews & "', '" & newid &
"'"
Dim Cmd As New System.Data.SqlClient.SqlCommand(sql, conn)
Dim objDR As System.Data.SqlClient.SqlDataReader
conn.Open()
objDR =
Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
'Cmd.ExecuteNonQuery()
conn.Close()
to me this should work!!!!
fine but not inserting and now im getting a "Error converting data type
varchar to numeric" which i didnt have before....
stored procedure is
CREATE Procedure newupdate
@newid varchar(50),
@newnews varchar(50)
AS
IF EXISTS (SELECT * FROM dbo.news WHERE ID =@newid)
UPDATE dbo.news SET news = @newnews WHERE Id =@newid
ELSE
INSERT into dbo.news (news) VALUES ("@newnews")
GO
which parses fine - so im guessing its the asp side of things
which is
Dim newid As String = TextBox1.Text.ToString
Dim newnews As String = TextBox2.Text.ToString
Dim strConn As String = "server=;uid=sa;pwd=;database=news"
Dim conn As New System.Data.SqlClient.SqlConnection(strConn)
Dim sql As String = "newupdate '" & newnews & "', '" & newid &
"'"
Dim Cmd As New System.Data.SqlClient.SqlCommand(sql, conn)
Dim objDR As System.Data.SqlClient.SqlDataReader
conn.Open()
objDR =
Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
'Cmd.ExecuteNonQuery()
conn.Close()
to me this should work!!!!