Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 11th, 2006, 01:59 AM
shawnleong shawnleong is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 19 shawnleong User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 28 sec
Reputation Power: 0
Unable to extract data from ms access

hi guys, i'm using ms access as my database and i can't seem to extract my data from a form that i've jus keyed in ... how is it so?it seems like my database is not updated yet. how can i do so? thanks.

Reply With Quote
  #2  
Old September 11th, 2006, 11:19 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,932 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 17 m 53 sec
Reputation Power: 2002
you could not be more vague.
what code you're using?
what you mean "from a form"? if it's not ordinary database table,
you can read it only via Access tools not with SQL statements.
"database not updated" - if you see the data, restart your computer
and still see the data - it's updated.

Reply With Quote
  #3  
Old September 13th, 2006, 02:10 AM
shawnleong shawnleong is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 19 shawnleong User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 28 sec
Reputation Power: 0
hi,
sorry for being vague.
i'm doing a program using vb, trying to get users to enter inputs such as name, x-coordinate, y-coordinate and store these values into my access database using the following codes:

Private Sub btnadd_Click()
Dim cn As ADODB.Connection
Dim cmd As ADODB.Command
Dim rs As ADODB.Recordset

Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.ConnectionTimeout = 10
cn.CommandTimeout = 10
cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.Open App.Path & "\dbanchorage.mdb", "admin", ""

SQL = "INSERT INTO tblCoordinates (name,x,y) VALUES ('" & txtname.Text & "','" & lblx2.Caption & "','" & lbly2.Caption & "')"

Call Sub executeSQL(SQL)

End Sub

Private Sub executeSQL(SQLCommand As String)
Set cmd = New ADODB.Command
cmd.ActiveConnection = cn
cmd.CommandText = SQLCommand
cmd.Execute
Set cmd = Nothing

End Sub


The above codes doesn't seems to have a problem as my db is getting and storing the values correctly. The problem is if i do the following my program doesn't seems to find any datas in my db even though i've keyed in say 3 sets of values already; my lstx will not display anything:

SQL= "SELECT * FROM tblCoordinates WHERE name = '" & txtname.Text &"'"
rs.Open SQL, cn, adOpenDynamic

Do Until rs.EOF
lstx.AddItem rs!x
rs.MoveNext
Loop

rs.Close
Set rs=nothing

I've tried to change my SQL to WHERE name = "name1"; name1 being an old data stored previously; i'm able to display the x values i want properly. how is this so?

thanks in advance

Reply With Quote
  #4  
Old September 13th, 2006, 02:37 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,932 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 17 m 53 sec
Reputation Power: 2002
what happens when you select all records?
Code:
SQL= "SELECT * FROM tblCoordinates"

also, have debug code to show you the SQL:
Code:
SQL= "SELECT * FROM tblCoordinates WHERE name = '" & txtname.Text &"'"
MessageBox(SQL)
rs.Open SQL, cn, adOpenDynamic

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Unable to extract data from ms access


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT