The code below creates a dataset containing a table
called "Customers" from the Northwind database
Later on in my code, after the database connection is
closed, I need to access this dataset to get all
records with "ContactTitle" = 'Owner' and "City"
= 'London'.
I have tried using the SELECT and Find methods of dataset
techbnology but I can't make them work with multi-
criteria queries.Help!
Bill
P.S. This is strictly a data import problem. I have no
datagrid controls to "bind" the records to. I need the
records back in a "loop-friendly" structure where I can
access them one by one.
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
' Open a connection to the database.
Dim strConnection As String = _
"Data Source=localhost; Initial
Catalog=Northwind;" _
& "Integrated Security=True"
Dim cn As SqlConnection = New SqlConnection(strConnection)
cn.Open()
' Set up a data set command object.
Dim strSelect As String = "SELECT * FROM Customers"
Dim dscmd As New SqlDataAdapter(strSelect, cn)
' Load data set.
Dim ds As New DataSet
dscmd.Fill(ds, "Customers")
' Close the connection.
cn.Close()
' Get all records in dataset matching ContactTitle, City
criteria.
' How can i do this?
' For testing purposes display neames using
' Console.Writeline
What's next??
End Sub 4 1319
You need the WHERE clause for example.
SELECT * FROM Customers WHERE City="London"
Tip: In Microsoft Access, build a query and then choose the View\SQL menu
option to see the SQL behind the query, you can copy and paste that into
your ADO.NET/VB.NET application.
Regards -OHM
bill salkin wrote: The code below creates a dataset containing a table called "Customers" from the Northwind database Later on in my code, after the database connection is closed, I need to access this dataset to get all records with "ContactTitle" = 'Owner' and "City" = 'London'.
I have tried using the SELECT and Find methods of dataset techbnology but I can't make them work with multi- criteria queries.Help!
Bill
P.S. This is strictly a data import problem. I have no datagrid controls to "bind" the records to. I need the records back in a "loop-friendly" structure where I can access them one by one.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Open a connection to the database. Dim strConnection As String = _ "Data Source=localhost; Initial Catalog=Northwind;" _ & "Integrated Security=True"
Dim cn As SqlConnection = New SqlConnection(strConnection) cn.Open()
' Set up a data set command object. Dim strSelect As String = "SELECT * FROM Customers" Dim dscmd As New SqlDataAdapter(strSelect, cn)
' Load data set. Dim ds As New DataSet dscmd.Fill(ds, "Customers")
' Close the connection. cn.Close()
' Get all records in dataset matching ContactTitle, City criteria.
' How can i do this?
' For testing purposes display neames using ' Console.Writeline
What's next??
End Sub
--
Best Regards - OHM
O_H_M{at}BTInternet{dot}com
Bill, OHM means :)
SELECT * FROM Customers WHERE City='London'
"One Handed Man [ OHM# ]" <O_H_M{at}BTInternet{dot}com> wrote in message
news:OK**************@TK2MSFTNGP09.phx.gbl... You need the WHERE clause for example.
SELECT * FROM Customers WHERE City="London"
Tip: In Microsoft Access, build a query and then choose the View\SQL menu option to see the SQL behind the query, you can copy and paste that into your ADO.NET/VB.NET application.
Regards -OHM
bill salkin wrote: The code below creates a dataset containing a table called "Customers" from the Northwind database Later on in my code, after the database connection is closed, I need to access this dataset to get all records with "ContactTitle" = 'Owner' and "City" = 'London'.
I have tried using the SELECT and Find methods of dataset techbnology but I can't make them work with multi- criteria queries.Help!
Bill
P.S. This is strictly a data import problem. I have no datagrid controls to "bind" the records to. I need the records back in a "loop-friendly" structure where I can access them one by one.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Open a connection to the database. Dim strConnection As String = _ "Data Source=localhost; Initial Catalog=Northwind;" _ & "Integrated Security=True"
Dim cn As SqlConnection = New SqlConnection(strConnection) cn.Open()
' Set up a data set command object. Dim strSelect As String = "SELECT * FROM Customers" Dim dscmd As New SqlDataAdapter(strSelect, cn)
' Load data set. Dim ds As New DataSet dscmd.Fill(ds, "Customers")
' Close the connection. cn.Close()
' Get all records in dataset matching ContactTitle, City criteria.
' How can i do this?
' For testing purposes display neames using ' Console.Writeline
What's next??
End Sub
-- Best Regards - OHM
O_H_M{at}BTInternet{dot}com
Picky, very Picky, but acknowledged.
Regards - OHM
-------------------------------
Hexathioorthooxalate wrote: Bill, OHM means :)
SELECT * FROM Customers WHERE City='London'
"One Handed Man [ OHM# ]" <O_H_M{at}BTInternet{dot}com> wrote in message news:OK**************@TK2MSFTNGP09.phx.gbl... You need the WHERE clause for example.
SELECT * FROM Customers WHERE City="London"
Tip: In Microsoft Access, build a query and then choose the View\SQL menu option to see the SQL behind the query, you can copy and paste that into your ADO.NET/VB.NET application.
Regards -OHM
bill salkin wrote: The code below creates a dataset containing a table called "Customers" from the Northwind database Later on in my code, after the database connection is closed, I need to access this dataset to get all records with "ContactTitle" = 'Owner' and "City" = 'London'.
I have tried using the SELECT and Find methods of dataset techbnology but I can't make them work with multi- criteria queries.Help!
Bill
P.S. This is strictly a data import problem. I have no datagrid controls to "bind" the records to. I need the records back in a "loop-friendly" structure where I can access them one by one.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Open a connection to the database. Dim strConnection As String = _ "Data Source=localhost; Initial Catalog=Northwind;" _ & "Integrated Security=True"
Dim cn As SqlConnection = New SqlConnection(strConnection) cn.Open()
' Set up a data set command object. Dim strSelect As String = "SELECT * FROM Customers" Dim dscmd As New SqlDataAdapter(strSelect, cn)
' Load data set. Dim ds As New DataSet dscmd.Fill(ds, "Customers")
' Close the connection. cn.Close()
' Get all records in dataset matching ContactTitle, City criteria.
' How can i do this?
' For testing purposes display neames using ' Console.Writeline
What's next??
End Sub
-- Best Regards - OHM
O_H_M{at}BTInternet{dot}com
--
Best Regards - OHM
O_H_M{at}BTInternet{dot}com
* "bill salkin" <an*******@discussions.microsoft.com> scripsit: I have tried using the SELECT and Find methods of dataset techbnology but I can't make them work with multi- criteria queries.
Maybe this group is more related to the topic of your question:
<news://msnews.microsoft.com/microsoft.public.dotnet.framework.adonet>
Web interface:
<http://msdn.microsoft.com/newsgroups/default.asp?url=/newsgroups/loadframes.asp?icp=msdn&slcid=us&newsgroup=microso ft.public.dotnet.framework.adonet>
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ian justice |
last post by:
Before i post actual code, as i need a speedyish reply.
Can i first ask if anyone knows off the top of their head, if there is
a likely obvious cause to the following problem.
For the moment i've...
|
by: lkrubner |
last post by:
Are there any benchmarks on how much an extra, unneeded VARCHAR, CHAR,
INT, BIGINT, TEXT or MEDIUMTEXT slows down a database call with MySql?
PostGre info would also be useful.
I'm trying to...
|
by: Michael |
last post by:
I have a problem forcing files to download. If I select Save the document is
saved with no problems. If I select "Open" the document is empty or I get a
"File not found" error from the application...
|
by: serge |
last post by:
Using "SELECT * " is a bad practice even
when using a VIEW instead of a table?
I have some stored procedures that are
identical with the difference of one statement
in the WHERE clause. If I...
|
by: GSteven |
last post by:
(as formerly posted to microsoft.public.access.forms with no result)
I've created a continuous form which is based on a straightforward table
(ex - customers - 100 records). On the form there is...
|
by: Lucky |
last post by:
hi guys!
Currently i'm facing a bit odd situation. i cant modify my code so i
have to make changes in SQL Server.
the problem is, i've modified one table by adding new column and now i
want...
|
by: divya |
last post by:
Hi,
I have a table tblbwday with 2 fields Name and Birthday.I have written
this script for displaying evryday names of the people on that day.
<%
set objConn...
|
by: saniac |
last post by:
I am working on a little project using pysqlite. It's going to be
exposed on the web, so I want to make sure I quote all incoming data
correctly. However, I've run into a brick wall trying to use...
|
by: Jenny |
last post by:
Dear all,
I have one select which lists one visible element. I want this select
can show scrollbar after I click its down arrow, so that i can use the
scrollbar to select the element i want.
...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |