473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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(App.Path & "\" & Nombre_BD)
Set RS = ConexionBD.OpenRecordset("Select * from tabla")
RS.Fields("companyiaParte")

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

Thanks
nahald

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

Something as this
\\\
Dim Conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " & "Data
Source=C:\SERVICIOS.MDB;" )
Try
Dim cmd As New OleDbCommand("Select * from tabla", Conn)
da = New OleDbDataAdapter(cmd)
da.Fill(ds, "tabla")
Catch oledbExc As OleDbException
MessageBox.Show(oledbExc.ToString)
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("tabla").rows(0).item("companyiaParte"). 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(App.Path & "\" & Nombre_BD)
Set RS = ConexionBD.OpenRecordset("Select * from tabla")
RS.Fields("companyiaParte")

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**************@tk2msftngp13.phx.gbl...
Hi Nahald,

Something as this
\\\
Dim Conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " & "Data Source=C:\SERVICIOS.MDB;" )
Try
Dim cmd As New OleDbCommand("Select * from tabla", Conn)
da = New OleDbDataAdapter(cmd)
da.Fill(ds, "tabla")
Catch oledbExc As OleDbException
MessageBox.Show(oledbExc.ToString)
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("tabla").rows(0).item("companyiaParte"). 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(App.Path & "\" & Nombre_BD)
Set RS = ConexionBD.OpenRecordset("Select * from tabla")
RS.Fields("companyiaParte")

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=Microsoft.Jet.OLEDB.4.0; " &

"Data
Source=C:\SERVICIOS.MDB;" )
Try
Dim cmd As New OleDbCommand("Select * from tabla", Conn)
dim ds as new Dataset
da = New OleDbDataAdapter(cmd)
da.Fill(ds, "tabla")
Catch oledbExc As OleDbException
MessageBox.Show(oledbExc.ToString)
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("tabla").rows(0).item("companyiaParte"). 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(App.Path & "\" & Nombre_BD)
Set RS = ConexionBD.OpenRecordset("Select * from tabla")
RS.Fields("companyiaParte")

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("Select * from tabla", Conn)

Is this true?

nahald

"Cor" <no*@non.com> escribió en el mensaje
news:Oz**************@TK2MSFTNGP12.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=Microsoft.Jet.OLEDB.4.0; " &

"Data
Source=C:\SERVICIOS.MDB;" )
Try
Dim cmd As New OleDbCommand("Select * from tabla", Conn)
dim ds as new Dataset
da = New OleDbDataAdapter(cmd)
da.Fill(ds, "tabla")
Catch oledbExc As OleDbException
MessageBox.Show(oledbExc.ToString)
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("tabla").rows(0).item("companyiaParte"). 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(App.Path & "\" & Nombre_BD)
> Set RS = ConexionBD.OpenRecordset("Select * from tabla")
> RS.Fields("companyiaParte")
>
> In visual basic .net, what am I do??
>



Nov 20 '05 #5
Cor
Nahald,

Yes and than add them to the dataAdapter with
da.DeleteCommand = 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 OleDbDataAdapter(cmd) Dim cb As New OleDbCommandBuilder(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.getchanges)
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("Select * from tabla", Conn)

Is this true?

nahald

> \\\
> Dim Conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " & "Data
> Source=C:\SERVICIOS.MDB;" )
> Try
> Dim cmd As New OleDbCommand("Select * from tabla", Conn)


dim ds as new Dataset
> > > > > da.Fill(ds, "tabla")
> Catch oledbExc As OleDbException
> MessageBox.Show(oledbExc.ToString)
> 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("tabla").rows(0).item("companyiaParte"). tostring
> ///
>

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

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

Yes and than add them to the dataAdapter with
da.DeleteCommand = 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 OleDbDataAdapter(cmd) Dim cb As New OleDbCommandBuilder(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.getchanges)
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("Select * from tabla", Conn)

Is this true?

nahald
> \\\
> > Dim Conn As New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " & > "Data
> > Source=C:\SERVICIOS.MDB;" )
> > Try
> > Dim cmd As New OleDbCommand("Select * from tabla", Conn)

dim ds as new Dataset

> > > > > > da.Fill(ds, "tabla")
> > Catch oledbExc As OleDbException
> > MessageBox.Show(oledbExc.ToString)
> > 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("tabla").rows(0).item("companyiaParte"). tostring
> > ///
> >


Nov 20 '05 #7

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

Similar topics

4
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...
3
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...
3
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...
8
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(...
46
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...
12
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...
1
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...
0
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 =...
14
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...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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,...
0
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...
0
Oralloy
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,...
0
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...
0
tracyyun
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...
0
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,...

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.