Click to See Complete Forum and Search --> : Updating data in a database


flappie
March 6th, 2003, 11:09 PM
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

addu
March 9th, 2003, 01:28 AM
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

flappie
March 9th, 2003, 07:20 AM
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 ??