Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 12th, 2006, 03:28 PM
Registered User
 
Join Date: Apr 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with Access Database retrieval.

OK.
I am using Visual Web Developer 2005 Express, I am using VB.NET for the programming language, and Access for the database.

Here is an overview of what I am trying to do :

I have an access database with 13 different columns, the first column has names that identify the other 12 columns and is the primary key.

I have the primary key displayed in a drop down menu.

I want to populate 12 text boxes with the values of the 12 columns in the database, but I want them populated according to what is selected in the drop down menu. Text boxes are necessary because the part of the equation that they control may be different from the values I have stored in the database.

I am an extreme newbie at databases and sql, can anyone help me here?

 
Old April 19th, 2006, 05:49 AM
Registered User
 
Join Date: Feb 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to samir_katore
Default

 Dear friend i have solution but it not possible to put it here as that i have coded the application to fetch the record from databse for selected value which is primary kay.

samir
 
Old April 19th, 2006, 05:54 AM
Registered User
 
Join Date: Feb 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to samir_katore
Default

Still if you want then here is code:
        Dim connectionString As String = "Driver={Microsoft Access Driver (*.mdb)};DBQ=\\Comp215\Database\Attendance.mdb"

 Dim queryString1 As String = "SELECT Status,Work_Hour,Day_Status,Emp_Id,Cur_Date from Emp_Attend where Cur_date BETWEEN " & "#" & Date1 & "# " & "AND " & "#" & Date2 & "#" & " And " & "Emp_Id = " & ID & " ORDER BY Emp_ID, Cur_Date "

        Using connection As New OdbcConnection(connectionString)

            Dim command1 As New OdbcCommand(queryString1, connection)
            connection.Open()
            Dim Emp_Attend As OdbcDataReader = command1.ExecuteReader()
            While Emp_Attend.Read()
                Textbox1.text = Emp_Attend(0)
                Textbox2.text = Emp_Attend(1)
                Textbox3.text = Emp_Attend(2)
                Textbox4.text = Emp_Attend(3)
                  :
                Textbox12.text = Emp_Attend(12)

 End While
            Emp_Attend.Close()
        End Using


================================================== =
Place these line top of code window in general declaration::

Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Odbc

samir
 
Old April 19th, 2006, 11:07 AM
Registered User
 
Join Date: Apr 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you, I will be trying this soon :)






Similar Threads
Thread Thread Starter Forum Replies Last Post
having problem in inserting in access database alto ASP.NET 2.0 Basics 4 May 24th, 2007 08:57 PM
Problem with Forgotten Password retrieval Insel Haber ASP.NET 2.0 Basics 1 October 18th, 2006 04:01 AM
Problem Using Access as the database, please help! hayley Classic ASP Databases 2 December 27th, 2004 02:29 AM
Compacting Access Database problem imaley SQL Language 1 April 23rd, 2004 11:28 AM
Speed database retrieval rajanikrishna Classic ASP Databases 1 March 1st, 2004 03:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.