i try to make a database with stored procedure and whan i run the program the give an error
"Invalid object name 'Product'."
i dont know how to fix it here is my code
Dim sqlcon As New SqlClient.SqlConnection
sqlcon.ConnectionString = "Data Source=WISEMAN\SQLEXPRESS;Initial Catalog=Product;Integrated Security=True;Pooling=False;uid=uid;pwd=pwd "
Dim cmd As New SqlClient.SqlCommand
cmd.Connection = sqlcon
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "insertcustomer"
cmd.Parameters.AddWithValue("@.Productid", TextBox1.Text)
cmd.Parameters.AddWithValue("@.detail", TextBox2.Text)
sqlcon.Open()
cmd.ExecuteScalar()
cmd.ExecuteNonQuery()
sqlcon.Close()
the error at line is cmd.executescalar()
My database name is product
my name for my storedprocedure is insertcustomer
Code for insertcustomer
ALTER PROCEDURE dbo.InsertCustomer
(
@.ProductID int output,
@.detail varchar(50)
)
AS
SET NOCOUNT ON
INSERT INTO Productdetail
(detail)
VALUES
(@.detail);
IF @.@.ROWCOUNT>0 AND @.@.ERROR>0
SELECT @.Detail = detail
From Productdetail
Where (ProductID =SCOPE_IDENTITY())
if u have any idee please tell meHi shadwise,
Welcome to thescripts. I'm sure you will find a wealth of information ion the various forums here. I am moving this thread to the SQL server forum. You will still be able to access this particular thread through the introductions page, but future questions should be directed to the appropriate forum (which you will find by selecting "forums" on the blue bar near the top of your screen.
I hope the experts in the SQL server forum can help with your query!!|||
Quote:
Originally Posted by shadwise
...i dont know how to fix it here is my code...
if u have any idee please tell me
Does your server or database have case-sensitive collation? Please copy/paste complete error description.
I'm not sure about "Invalid object name 'Product'" problem, but there are several other problem worth mentioning:Wrap SqlConnection and SqlCommand scope with using (C# keyword, don't know correct VB syntax)
No comments:
Post a Comment