CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2003
    Location
    RSA
    Posts
    16

    Post Updating data in a database

    I have a problem which I believe should be easy for most programmers, but I cannot find the answer to it in any of the Microsoft Course manuals that I have (ADO.NET & Web Develeopment Technologies) nor I can I find it on the web.

    I have created a webform with textboxes (ASP:textbox) and want the information that the user inputs in it to add to a table in a microsoft access database. (future attempts will be to modify and delete)

    If anyone can direct me in the right direction or send me sample code I would really appreciate it.

    Thank you

    Bernhard

  2. #2
    Join Date
    Mar 2003
    Location
    Pakistan, Karachi
    Posts
    4
    hey!

    u will hav to make a bridge b/w ur application n ur database! through which u will carry out your data manipulation queries.

    if ur backend is sql server! then here is the same code,

    i hav implemented this in a class! just adjust it.....
    Imports System
    Imports System.Web.UI
    Imports System.Web.UI.WebControls
    Imports System.Data
    Imports System.Data.SqlClient
    Dim strConnection As String = "user id=sa;password=;"


    public sub update(string as SqlQuery) strConnection+= "Database=yourdatabasename;server=yourservername;"
    strConnection += "Connect Timeout=30"


    Dim objConnection As New SqlConnection(strConnection)

    Dim objCommand As New SqlCommand(SqlQuery,objConnection)
    objConnection.Open()

    objCommand.ExecuteReader()
    objConnection.Close()
    end sub

    i am sending the sqlQuery as input to this procedure. eg for sqlQuery can be "Update Employee set EmployeeName='Tony' where EmployeeNumber=1419"

    hope it helps ur cause!
    cya
    addy
    KnowLedge is Power

  3. #3
    Join Date
    Mar 2003
    Location
    RSA
    Posts
    16
    Thank you for your reply. My problem is that I am needing to integrate with MS Access. Whereever you have a command for SQL, should I change that to OleDB ??

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