VB.NET 2008 & SQL 2008 :Invalid object name RRS feed

  • Question

  • Hello there,

    i am pretty new in VB.NET 2008 & SQL. I am working on a app that has a employee form with button named btnEmpRmk.On cliicking  brnEmpRmk,a new form(frmEmpRmk) will open having a multilined textbox and two buttons named btnSave and btnClose respectively.The textbox is used for the comment/remark detail for any employee from the employee form.The save button is used to save this detail in the SQL server 2008 where the EmpSrno = txtRegno.text from the employee form. This does not happen,instead i keep on getting this error "Invalid object name,'emp_name'". (dbo.emp_name is existing in my employee database)

     and  the following line is highlighted in the debugging mode

    dacust.FillSchema(dsRmk, SchemaType.Source, "emp_master")

    Please your help will be appreciated.

    The codes are as follow:




    Employee form 's object declaration
















    Employee form's code for btnEmpRmk button

      Private Sub btnEmpRmk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmpRmk.Click

    Me.empname = Me.txtName.Text ' value of txtName from employee form is stored in empname

     MsgBox("Pls Enter The Employee Name")



     frmEmpRmk2.Text ="Remark for" & " " & empname & "with Staff no " & " " & empRegno

     End If

    End Sub

    frmEmpRmk's code snippet










    Class frmEmpRmk



    Public Objconstr As String = "server=FOLA\SQLEXPRESS;database=MyWorkshop;uid=Fola;password=stallion"

    Public reply As Integer = 0  Public Objconstr As String = "server=FOLA\SQLEXPRESS;database=MyAdmin;uid=Fola;password=stallion"
    Public empRegno As Integer
    Public empname As String
    Protected Const DEFAULT_SORT1 As String = " r_id DESC"
    class Form1 Dim cn As SqlClient.SqlConnection Dim da As SqlClient.SqlDataAdapter im ds As New DataSet Dim dt As System.Data.DataTable Dim cm As SqlClient.SqlCommand Dim dr As SqlDataReader Dim drCurrent As DataRow Dim dv As New DataView Protected Const DEFAULT_SORT As String = " Emp_Name ASC"
    • Edited by folieboy Thursday, June 17, 2010 2:00 PM inot well edited
    Thursday, June 17, 2010 1:17 PM