CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Sep 2006
    Posts
    1

    Errors while adding rows to Database

    i am working on two databases one is for human resource management and the other is of projects details. my problem is occuring while saving record or deleting record. i've created a form of departments where i am inserting Department_ID, Department_Name and Location when i entered values and press add then there is an erroe of type casting.
    i am casting the text values into integer but the problem is still unsolved the code behind add button is :

    Code:
    Dim drAdd As DataRow
            Dim value As Integer
            value = CInt(TextBox1.Text)
            drAdd = DsDep1.Tables("Departments_Detail").NewRow()
            drAdd(0) = value
            drAdd(1) = TextBox2.Text
            drAdd(2) = TextBox3.Text
            DsDep1.Tables("Departments_Detail").Rows.Add(drAdd)
            DaDep.Update(DsDep1, "Departments_Detail")
    
            MsgBox("New Record added to the Database")
    data types are:

    Department_ID = Integer
    Department_Name = Varchar
    Location = Text
    Last edited by HanneSThEGreaT; October 2nd, 2006 at 05:10 AM. Reason: Added Code Tags

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured