2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by abhay1234
0

create database test10.mdb and create a table ..name it as "table1" add columns "username" and "password"

In asp.net add two textboxes and a button

put this code in button

Imports System.Data.OleDb


Partial Class _Default
    Inherits System.Web.UI.Page
    Dim conn As OleDbConnection
    Dim cmd As OleDbCommand
    Dim i As Integer


    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        conn = New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0; Data Source=c:\test10.mdb")
        conn.Open()
        Dim str As String
        str = "insert into table1 values(' " & TextBox1.Text & "',' " & TextBox2.Text & "')"
       cmd = New OleDbCommand(str, conn)


        i = cmd.ExecuteNonQuery()
        MsgBox(i)
        conn.Close()

    End Sub

    
End Class

enter the desired username and password in the two textboxes and you will find it updated in the access table

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.