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 6 993
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??
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??
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??
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?? >
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 > /// >
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 > > /// > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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(...
|
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...
|
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...
|
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...
|
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 =...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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...
|
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,...
| |