Ok, I have the following code. Does any one know how I go about taking this
record set and trying to find if a record exits in it? - Thanks Dale
Imports System.Data.Sql Client
Public Module modLoadDefaults
Public gCONN As New SqlConnection
Public gbMakeConnectio n As Boolean
Public rsUsers As New Data.DataTable( "Users")
Private Function MakeConnection( ) As SqlConnection
If gCONN.State <> ConnectionState .Open Then
With gCONN
.ConnectionStri ng = "Integrated Security=TRUE;I nitial
Catalog=SQL_Tes t;Data Source=SERVER\S QLtest "
End With
End If
gbMakeConnectio n = True
Return gCONN
End Function
Public Function GetUsers() As DataTable
Dim connection As SqlConnection = MakeConnection( )
Dim da As New SqlDataAdapter( "SELECT * FROM USERS", gCONN)
If gbMakeConnectio n Then
gCONN.Open()
da.Fill(rsUsers )
If connection.Stat e <> ConnectionState .Closed Then
connection.Clos e()
Return rsUsers
End If
End Function 4 3931
follow the heirarchy, dataset has tables, tables.count.
tables has rows. rows.count ...........
"dkalsow" wrote: Ok, I have the following code. Does any one know how I go about taking this record set and trying to find if a record exits in it? - Thanks Dale
Imports System.Data.Sql Client
Public Module modLoadDefaults
Public gCONN As New SqlConnection Public gbMakeConnectio n As Boolean Public rsUsers As New Data.DataTable( "Users")
Private Function MakeConnection( ) As SqlConnection
If gCONN.State <> ConnectionState .Open Then With gCONN .ConnectionStri ng = "Integrated Security=TRUE;I nitial Catalog=SQL_Tes t;Data Source=SERVER\S QLtest " End With End If
gbMakeConnectio n = True
Return gCONN
End Function
Public Function GetUsers() As DataTable
Dim connection As SqlConnection = MakeConnection( ) Dim da As New SqlDataAdapter( "SELECT * FROM USERS", gCONN) If gbMakeConnectio n Then gCONN.Open() da.Fill(rsUsers ) If connection.Stat e <> ConnectionState .Closed Then connection.Clos e() Return rsUsers End If
End Function
So what rsUsers.DataSet .????
"s_cnot" wrote: follow the heirarchy, dataset has tables, tables.count. tables has rows. rows.count ...........
"dkalsow" wrote:
Ok, I have the following code. Does any one know how I go about taking this record set and trying to find if a record exits in it? - Thanks Dale
Imports System.Data.Sql Client
Public Module modLoadDefaults
Public gCONN As New SqlConnection Public gbMakeConnectio n As Boolean Public rsUsers As New Data.DataTable( "Users")
Private Function MakeConnection( ) As SqlConnection
If gCONN.State <> ConnectionState .Open Then With gCONN .ConnectionStri ng = "Integrated Security=TRUE;I nitial Catalog=SQL_Tes t;Data Source=SERVER\S QLtest " End With End If
gbMakeConnectio n = True
Return gCONN
End Function
Public Function GetUsers() As DataTable
Dim connection As SqlConnection = MakeConnection( ) Dim da As New SqlDataAdapter( "SELECT * FROM USERS", gCONN) If gbMakeConnectio n Then gCONN.Open() da.Fill(rsUsers ) If connection.Stat e <> ConnectionState .Closed Then connection.Clos e() Return rsUsers End If
End Function
On Mon, 27 Sep 2004 12:53:03 -0700, dkalsow wrote: So what rsUsers.DataSet .???? Public rsUsers As New Data.DataTable( "Users")
In your code, rsUsers is a DataTable. Did you look at the member functions
of the DataTable class in the documentation? If you had, you would have
seen the Select method which returns an array of DataRows based on criteria
that you specify.
So you could use code similar to this:
Dim strExpression As String = "id > 6" 'Or whatever criteria you need
Dim strSort As String = "name DESC" 'Or whatever sort order you need
'This creates an array of rows that meet the expression "id > 6"
Dim selectedRows as DataRow() = rsUsers.Select( strExpression, strSort)
'This selects ALL rows
Dim allRows As DataRow() = rsUsers.Select( )
Check out the docs on DataSet, DataTable, and DataRow. There is a lot of
useful information there.
--
Chris
dunawayc[AT]sbcglobal_lunch meat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
I second that you can also create a dataview for this table and set the row
filter to the expression.
"Chris Dunaway" <"dunawayc[[at]_lunchmeat" wrote: On Mon, 27 Sep 2004 12:53:03 -0700, dkalsow wrote:
So what rsUsers.DataSet .????
Public rsUsers As New Data.DataTable( "Users")
In your code, rsUsers is a DataTable. Did you look at the member functions of the DataTable class in the documentation? If you had, you would have seen the Select method which returns an array of DataRows based on criteria that you specify.
So you could use code similar to this:
Dim strExpression As String = "id > 6" 'Or whatever criteria you need Dim strSort As String = "name DESC" 'Or whatever sort order you need
'This creates an array of rows that meet the expression "id > 6" Dim selectedRows as DataRow() = rsUsers.Select( strExpression, strSort)
'This selects ALL rows Dim allRows As DataRow() = rsUsers.Select( )
Check out the docs on DataSet, DataTable, and DataRow. There is a lot of useful information there.
-- Chris
dunawayc[AT]sbcglobal_lunch meat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and replace certain words in my E-Mail address. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JIMMIE WHITAKER |
last post by:
Can someone help on this:
I am just learning, and I'm connecting to the the northwindcs.mdf tables /
open file is northwindcs.adp.
This is the sample installed using msde, which is supposed to be mini sql
server to learn.
Please don't refer me elsewhere, here is what I'm trying to learn:
If I want to hit a command button and do the following:
1. Find a customerid
2. if found, edit the record, if not found, add a new record.
How would...
|
by: Andrei Ivanov |
last post by:
Hello,
it seems my postgresql data has somehow become corrupted (by a forced
shutdown I think):
psql template1 -U shadow
Password:
ERROR: nodeRead: did not find '}' at end of plan node
Welcome to psql 7.3.4, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
|
by: Daniel |
last post by:
I use an Access database to basically take data exports, import them,
manipulate the data, and then turn them into exportable reports. I do
this using numerous macros, and queries to get the data in the format
that I need it in order to create the reports that we use. So far this
has proven to be successful for the reports that I am doing and the
data that I am pulling into it. I just have one challenge that may
require a lot of work and I...
|
by: Randy |
last post by:
I have been able to set up a Find Record Button on my switchboard to
take me to a form with the correct case number by using a parameter
query and macro.
When I try to run the Find Record button from the macro on the form I
want to find the record in it just sits there and does not run.
Could someone tell me how to fix this? Please be specific as I am new
to Access.
|
by: Jim Heavey |
last post by:
Hello, I am running into something strange. I am getting the following error
when the program attempts to execute a particular procedure:
An unhandled exception of type 'System.MissingMemberException' occurred in
microsoft.visualbasic.dll
Additional information: Public member 'FindSearchValueRecord' on type
'ProfileRecordProcessing' not found.
This seems to suggest that the function "FindSearchValueRecord" does not
| |
by: Aaron Smith |
last post by:
Dim dv As DataView = New DataView(FacilitiesDS1.Facilities, "", "ID
ASC", DataViewRowState.CurrentRows)
Dim iPos As Integer = dv.Find(dr.Item("ID"))
Me.BindingContext(FacilitiesDS1, "Facilities").Position = iPos
That is the code.. dr is DataRow. If dr.Item("ID") = 3, the find will
return position 0, which it should have been 1, and if the ID = 2, it
will return 1, which should have been 0.. The DA has a connection string
that sorts it...
|
by: sean |
last post by:
I have a table with fixed row of records SORTED by DATE using ADO pagination
method. The user can click a link in one table cell and go to another page
to modify the record. Once the updated record is saved the user will be
redirect back to the table. This time the record updated will be highlighted
so that the user knows where he came from. I basically pass the page number,
column and row number via querystring and store the info in a...
|
by: john |
last post by:
In my form I have a master table and a details table linked 1xM. I can
search through the whole parent table but I also like to be able to search
through the child table fields to find parent records. Should I design a new
form for this or can I somehow make this work in the same form.
Thanks in advance,
john
|
by: farhan31 |
last post by:
Hello all
I have Two tables.Table 1 and table 2.Table 1 has one to many relation with Table 2.I have one main form Form1 based on table 1.On form 1 i have a sub form based on table 2.I have put a find record button on main form i.e Form 1.Master/child relation is already established.Find button works fine with main form.it changes the main form entries and the sub form entries accordingly.this button doesnot work with sub form.this means that...
|
by: Run2Eat |
last post by:
i feel like this is a doofus question... but i've created an access form and added a find record button, but when i use the form, the find record button searches the form itself, not the table. all the other buttons work, so i believe the form is linked to the table. how can i get the find record button to search the table, not the form itself?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |