Reg:-Sqlserver 2000 data insertion

Results 1 to 2 of 2

Thread: Reg:-Sqlserver 2000 data insertion

  1. #1
    Join Date
    Dec 1969

    Default Reg:-Sqlserver 2000 data insertion

    Hi all,<BR>1.when i am inserting data into sqlserver2000 through page:-<BR><BR> Dim InsertCmd As String = "insert into register_tab (name,age) values (@name, @age)"<BR> Dim Mycommand As SqlCommand<BR> Mycommand = New SqlCommand(InsertCmd, MyConnection)<BR><BR> Mycommand.Parameters.Add(New SqlParameter("@name", SqlDbType.Char, 30))<BR> Mycommand.Parameters("@name").Value = txtname.Text<BR><BR> Mycommand.Parameters.Add(New SqlParameter("@age", SqlDbType.Int, 4))<BR><BR> Mycommand.Parameters("@age").Value = txtage.Text<BR><BR><BR> Mycommand.Connection.Open()<BR><BR> <BR> Mycommand.ExecuteNonQuery()<BR><BR>it gives error like this:-<BR><BR>Exception Details: <BR>System.Data.SqlClient.SqlException: Invalid object name &#039;register_tab&#039;. <BR><BR><BR>Thanks for ur reply,<BR>ulaga<BR>

  2. #2
    Join Date
    Dec 1969

    Default Ok so first do you have a

    database table called &#039;register_tab&#039;?<BR><BR>If that&#039;s correct, then try qualifying the table with the owner&#039;s name.<BR><BR> insert into owner.register_tab ...blah blah<BR><BR>Not sure if SQL Server supports them, however you might also be able to create a db object called a &#039;synonym&#039; for that table. Then you wouldn&#039;t have to qualify it with the owner name, regardless if you are not the table owner.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts