473,671 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BD with access y reference your fields

hello,
I have a problem to a database (Access) and I reference its fields
before in Vb 6, I am do this with:

Dim RS As Recordset
Nombre_BD = "SERVICIOS. MDB"
Set ConexionBD = OpenDatabase(Ap p.Path & "\" & Nombre_BD)
Set RS = ConexionBD.Open Recordset("Sele ct * from tabla")
RS.Fields("comp anyiaParte")

In visual basic .net, what am I do??

Thanks
nahald

Nov 20 '05 #1
6 1001
Cor
Hi Nahald,

Something as this
\\\
Dim Conn As New OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;" & "Data
Source=C:\SERVI CIOS.MDB;" )
Try
Dim cmd As New OleDbCommand("S elect * from tabla", Conn)
da = New OleDbDataAdapte r(cmd)
da.Fill(ds, "tabla")
Catch oledbExc As OleDbException
MessageBox.Show (oledbExc.ToStr ing)
Catch ex As Exception
MessageBox.Show (ex.Message)
Finally
Conn.Close()
End Try
The item from the first row is
dim a as string = ds.tables("tabl a").rows(0).ite m("companyiaPar te").tostring
///

I hope this was what you where looking for?

Cor

hello,
I have a problem to a database (Access) and I reference its fields
before in Vb 6, I am do this with:

Dim RS As Recordset
Nombre_BD = "SERVICIOS. MDB"
Set ConexionBD = OpenDatabase(Ap p.Path & "\" & Nombre_BD)
Set RS = ConexionBD.Open Recordset("Sele ct * from tabla")
RS.Fields("comp anyiaParte")

In visual basic .net, what am I do??

Nov 20 '05 #2
Sorry, but You don´t defined ds than a variable, What is "ds"?

"Cor" <no*@non.com> escribió en el mensaje
news:OK******** ******@tk2msftn gp13.phx.gbl...
Hi Nahald,

Something as this
\\\
Dim Conn As New OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;" & "Data Source=C:\SERVI CIOS.MDB;" )
Try
Dim cmd As New OleDbCommand("S elect * from tabla", Conn)
da = New OleDbDataAdapte r(cmd)
da.Fill(ds, "tabla")
Catch oledbExc As OleDbException
MessageBox.Show (oledbExc.ToStr ing)
Catch ex As Exception
MessageBox.Show (ex.Message)
Finally
Conn.Close()
End Try
The item from the first row is
dim a as string = ds.tables("tabl a").rows(0).ite m("companyiaPar te").tostring ///

I hope this was what you where looking for?

Cor

hello,
I have a problem to a database (Access) and I reference its fields
before in Vb 6, I am do this with:

Dim RS As Recordset
Nombre_BD = "SERVICIOS. MDB"
Set ConexionBD = OpenDatabase(Ap p.Path & "\" & Nombre_BD)
Set RS = ConexionBD.Open Recordset("Sele ct * from tabla")
RS.Fields("comp anyiaParte")

In visual basic .net, what am I do??


Nov 20 '05 #3
Cor
Hi Nahald,

Good you showed me I forgot that row

Now it is between the text

Sorry.

Cor
Sorry, but You don´t defined ds than a variable, What is "ds"?

Something as this
\\\
Dim Conn As New OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;" &

"Data
Source=C:\SERVI CIOS.MDB;" )
Try
Dim cmd As New OleDbCommand("S elect * from tabla", Conn)
dim ds as new Dataset
da = New OleDbDataAdapte r(cmd)
da.Fill(ds, "tabla")
Catch oledbExc As OleDbException
MessageBox.Show (oledbExc.ToStr ing)
Catch ex As Exception
MessageBox.Show (ex.Message)
Finally
Conn.Close()
End Try
The item from the first row is
dim a as string =

ds.tables("tabl a").rows(0).ite m("companyiaPar te").tostring
///

I hope this was what you where looking for?

Cor

hello,
I have a problem to a database (Access) and I reference its fields
before in Vb 6, I am do this with:

Dim RS As Recordset
Nombre_BD = "SERVICIOS. MDB"
Set ConexionBD = OpenDatabase(Ap p.Path & "\" & Nombre_BD)
Set RS = ConexionBD.Open Recordset("Sele ct * from tabla")
RS.Fields("comp anyiaParte")

In visual basic .net, what am I do??



Nov 20 '05 #4
ok, thanks I think this line.
If I have to do a insert, update o delete in database, I will change this
line:

Dim cmd As New OleDbCommand("S elect * from tabla", Conn)

Is this true?

nahald

"Cor" <no*@non.com> escribió en el mensaje
news:Oz******** ******@TK2MSFTN GP12.phx.gbl...
Hi Nahald,

Good you showed me I forgot that row

Now it is between the text

Sorry.

Cor
Sorry, but You don´t defined ds than a variable, What is "ds"?

Something as this
\\\
Dim Conn As New OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;" &

"Data
Source=C:\SERVI CIOS.MDB;" )
Try
Dim cmd As New OleDbCommand("S elect * from tabla", Conn)
dim ds as new Dataset
da = New OleDbDataAdapte r(cmd)
da.Fill(ds, "tabla")
Catch oledbExc As OleDbException
MessageBox.Show (oledbExc.ToStr ing)
Catch ex As Exception
MessageBox.Show (ex.Message)
Finally
Conn.Close()
End Try
The item from the first row is
dim a as string =

ds.tables("tabl a").rows(0).ite m("companyiaPar te").tostring
///

I hope this was what you where looking for?

Cor
> hello,
> I have a problem to a database (Access) and I reference its fields
> before in Vb 6, I am do this with:
>
> Dim RS As Recordset
> Nombre_BD = "SERVICIOS. MDB"
> Set ConexionBD = OpenDatabase(Ap p.Path & "\" & Nombre_BD)
> Set RS = ConexionBD.Open Recordset("Sele ct * from tabla")
> RS.Fields("comp anyiaParte")
>
> In visual basic .net, what am I do??
>



Nov 20 '05 #5
Cor
Nahald,

Yes and than add them to the dataAdapter with
da.DeleteComman d = cmd (to do for the insertcommand, the deletecommand and
the updatecommand)

But for an update for a select as you are using it is more simple to add
after the
da = New OleDbDataAdapte r(cmd) Dim cb As New OleDbCommandBui lder(da)
(that makes and add the update, delete and insert for you, but they said it
is buggy with a lot of parameters).

When you have done that you can do to update
\\\
if ds.haschanges
da.update(ds.ge tchanges)
end if
///

Cor
ok, thanks I think this line.
If I have to do a insert, update o delete in database, I will change this
line:

Dim cmd As New OleDbCommand("S elect * from tabla", Conn)

Is this true?

nahald

> \\\
> Dim Conn As New OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;" & "Data
> Source=C:\SERVI CIOS.MDB;" )
> Try
> Dim cmd As New OleDbCommand("S elect * from tabla", Conn)


dim ds as new Dataset
> > > > > da.Fill(ds, "tabla")
> Catch oledbExc As OleDbException
> MessageBox.Show (oledbExc.ToStr ing)
> Catch ex As Exception
> MessageBox.Show (ex.Message)
> Finally
> Conn.Close()
> End Try
> The item from the first row is
> dim a as string =
ds.tables("tabl a").rows(0).ite m("companyiaPar te").tostring
> ///
>

Nov 20 '05 #6
Thanks for all
I will test this.
nahald

"Cor" <no*@non.com> escribió en el mensaje
news:OR******** ******@TK2MSFTN GP11.phx.gbl...
Nahald,

Yes and than add them to the dataAdapter with
da.DeleteComman d = cmd (to do for the insertcommand, the deletecommand and the updatecommand)

But for an update for a select as you are using it is more simple to add
after the
da = New OleDbDataAdapte r(cmd) Dim cb As New OleDbCommandBui lder(da)
(that makes and add the update, delete and insert for you, but they said it is buggy with a lot of parameters).

When you have done that you can do to update
\\\
if ds.haschanges
da.update(ds.ge tchanges)
end if
///

Cor
ok, thanks I think this line.
If I have to do a insert, update o delete in database, I will change this line:

Dim cmd As New OleDbCommand("S elect * from tabla", Conn)

Is this true?

nahald
> \\\
> > Dim Conn As New
OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;" & > "Data
> > Source=C:\SERVI CIOS.MDB;" )
> > Try
> > Dim cmd As New OleDbCommand("S elect * from tabla", Conn)

dim ds as new Dataset

> > > > > > da.Fill(ds, "tabla")
> > Catch oledbExc As OleDbException
> > MessageBox.Show (oledbExc.ToStr ing)
> > Catch ex As Exception
> > MessageBox.Show (ex.Message)
> > Finally
> > Conn.Close()
> > End Try
> > The item from the first row is
> > dim a as string =
> ds.tables("tabl a").rows(0).ite m("companyiaPar te").tostring
> > ///
> >


Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
9283
by: Thys Brits | last post by:
Hi, I'm using the System.Web.Mail class to send an e-mail from my ASP.Net application, but when sending the e-mail, I'm getting the above error. It seems to be because I have Office XP installed, and the version of CDO is replaced by this installation. I haven't been able to find this error anywhere on any MS site. Anyone have a clue on how to then actually send the e-mail? Thanks
3
23452
by: Jon Ole Hedne | last post by:
My Access 2002-application need to work with tables from both Oracle and Access. To solve this, I want to run some querys on three views in Oracle and import the results into temporary Access-tables. I have tried this: conn.Provider = "Microsoft.Jet.OLEDB.4.0" conn.ConnectionString = "data source=" & datafil & ";Jet OLEDB:Database Password=" conn.Open datafil
3
3705
by: CSDunn | last post by:
Hello, I have a situation with MS Access 2000 in which I need to display report data in spreadsheet orientation (much like a datasheet view for a form). If you think of the report in terms of what a spreadsheet might show, the column names will actually be dynamic, based on data from a SQL Server 2000 database. The row data will also come from the same database. So in this case, I will have a main report and a subreport. I've already tried...
8
3986
by: doomx | last post by:
I'm using SQL scripts to create and alter tables in my DB I want to know if it's possible to fill the description(like in the Create table UI) using these scripts. EX: CREATE TABLE( Pk_myPrimaryKey INTEGER CONSTRAINT pk PRIMARY KEY DESCRIPTION 'This is the primary key of the table',
46
3835
by: Adam Turner via AccessMonster.com | last post by:
If I had a field called "Name" in an Access table "Contact Info", and the field contained VBScript... Function Main(rstFields) Main = rstFields.Item("FirstName").Value End Function 1. How do I pass a recordset into this field? 2. How do I capture the return value?
12
3569
by: Art | last post by:
Hi everyone I was hoping someone might be able to help me with this. I'm just starting to try to work with MS Access tables through VB.net. In Access I can take an existing table and add a new field with the type AutoNumber. I can then set this up as a key. Then if I go into the table I will see sequential numbers have been inserted into that field for me. Can I do this through VB.net I'd appreciate any help or alternative suggestions...
1
2698
by: rick m | last post by:
We have an access DB that 2 input people use to tracking incoming patients. There is a form for them to do this but they find it confusing to use (it's plainly laid out, no one else complains about it). Management has decided that they want me to link 15 of our templates so when a template is opened and text entered into one of the text fields it will automatically be entered into the database. First of all, is this possible? ...
0
1410
by: pedz | last post by:
I am trying to write a set of classes, probably template classes, to allow "pretty" and safe access to low level machine words. The syntax I would like to end up with is something like: foo = handle.vendor_id.get(); where handle would represent, in this case, the PCI config space, vendor_id is a particular offset into that space, and get is a method to retrieve the current value. To add complexity, some registers are a set of bits or bit...
14
2895
by: awayne | last post by:
I am working with MS VB 6.5. I am putting together a MS Access (MS Access 2000) database for work to keep track of the projects and their status that we've done. I use MS Access to run a "Make-table query" that sorts by Ascending date (date is (Field(5) for coding purposes) and then use the information in the table to create the table in a word document. The query also captures beginning and ending dates so people can create a report that covers...
0
1503
by: AlexNunley | last post by:
I am trying to dump data from an access query into excel so I can pretify it. I found sample code from an old access 97 book (The version of access in use)and tinkered it into working. Well sort of. The error I get is usually a "Object Required" error, and it highlights the bolded section below. I have been through this thing backwards and forth and cannot figure it out. I am new to this whole thing, so be easy on me. Thanks! Alex ...
0
8481
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8400
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,...
0
8823
jinu1996
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...
1
8602
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7441
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6234
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4227
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...
0
4412
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.