Asp.net

am trying to connect to access database 2007 using asp.net or vb.net

Page 1 of 1

2 Replies - 1111 Views - Last Post: 29 April 2010 - 07:23 AM Rate Topic: -----

#1 stungwana  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 28-April 10

Asp.net

Posted 29 April 2010 - 12:07 AM

I have been trying to connect to access database 2007 using VB.net and asp.net for so long plz anyone that can help me do this becouse its giving me hard time now am behind in terms of work .Plz help here is my Imports System.IO

Imports system.data
Imports System.Data.OleDb
Partial Class _Default
    Inherits System.Web.UI.Page
    Dim connstring As String
    Dim conn As OleDbConnection
    Dim command As OleDbCommand
    Dim datareader As OleDbDataReader




    Protected Sub butOK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles butOK.Click
        Response.Redirect("ENFORCEMENT-REPORT.aspx")
        connstring = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data SOURCE=C:\Datadb.mdb"
        conn = New OleDbConnection(connstring)
        Command = New OleDbCommand()
        Command.Connection = conn
        Command.CommandText = "SELECT * FROM Details WHERE Username'" & txtuser.Text & "'and Pass='" & txtpass.Text & "'"
        Try
            conn.Open()
            datareader = Command.ExecuteReader()
            If datareader.Read = True Then
                Response.Redirect("ENFORCEMENT-REPORT.aspx")
            Else
                lblshow.Text = "incorrect username or Password"

            End If

        Catch ex As Exception
            lblshow.Text = "incorrect username or Password"

        End Try

        Response.Redirect("ENFORCEMENT-REPORT.asp



    End Subcode and its not giving me an error.


This post has been edited by no2pencil: 29 April 2010 - 12:19 AM
Reason for edit:: Added code tags


Is This A Good Question/Topic? 0
  • +

Replies To: Asp.net

#2 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5379
  • View blog
  • Posts: 27,350
  • Joined: 10-May 07

Re: Asp.net

Posted 29 April 2010 - 12:20 AM

** Added code tags & moved to Asp.net **
Was This Post Helpful? 0
  • +
  • -

#3 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Asp.net

Posted 29 April 2010 - 07:23 AM

Why don't you describe what should be happening?

Currently, you connect to your database, but you don't do anything with the data. You simply redirect to a different page, so I'm not sure what you intention is.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1