Programming Theory
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesProgramming Theory

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 Codewalkers Forums Sponsor:
  #1  
Old May 14th, 2009, 01:58 AM
svibuk svibuk is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: May 2009
Posts: 2 svibuk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 16 m 54 sec
Reputation Power: 0
Cannot find table(0)

i have 2 tables from where the data is taken
table 1 and table 2
table1 has user, country, city
table2 has country,city

wht i need is

1) selecting user with condition of country and city dropdownlists = the output can be multiple & after exceution of he query
need to get the users


2) selecting fields from table2 from the grid depending on the id( i am getting the selected multiple id from the grid.== uid)

then inserting the user , country , city in table1 with country, city selected fom table 2

if table1 has the combination of user , country , city then update else insert

i have written the code but not getting the desired output
if i use in the below way ie line1 & line2 then i get no error but only the last record in for loop gets affected
and if i use line2 and then line1 i get



sqlstr= "SELECT user FROM table1 " _
& " WHERE country='" & drpcountry.SelectedItem.Text & "' AND city='" & drpcity.SelectedItem.Text & "'"
USERREADER = cmdMain.ExecuteReader()

If USERREADER.HasRows Then
While USERREADER.Read
dim uname= USERREADER("user").ToString.Trim
msgbox(uname)


sqlstr= "select [country],[city] FROM table2 WHERE ID in( " & UID & ") order by country"
''''''''''''''''''''''''''''''''''''''executing the query using dataset


If ds.Tables(0).Rows.Count > 0 Then
Dim count = ds.Tables(0).Rows.Count


For i = 0 To count - 1

Dim datacountry = ds.Tables(0).Rows(i).Item("country").ToString()
Dim datacity = ds.Tables(0).Rows(i).Item("city").ToString()



sqlstr= "IF EXISTS (SELECT user, country,city FROM table1 " _
& " WHERE user='" & uname & "'" _
& " AND country='" & datacountry & "' AND city='" & datacity & "')" _
& " UPDATE table1 set user='" & uname & "' " _
& " WHERE country='" & datacountry & "' AND city='" & datacity & "' " _
& " Else " _
& " INSERT INTO table1(user,country,city) " _
& " VALUES ('" & uname & "','" & datacountry & "','" & datacity & "')"

Next ''''''' line1

'''''''''''''''''''' executing the query using dataset ''''''''line2

End If


End While
End If
End If



getting error cannot find table(0)

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesProgramming Theory > Cannot find table(0)


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.

Request Your Free Technology Downloads!
 
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.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
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.

Request Your Free Technology Downloads!
 
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.

Request Your Free Technology Downloads!
 

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




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek