Hello,
I am new to this group and I hope someone can help me *g*.
I am good in VBS but now I want to switch to vb.net because of getting crazy while creating every form in VBS with InternetExplore r an HTML.
OK. Now here is my first question:
I have an Access-Database and I want to get some information out of it.
The code works and looks loke this:
----------------------------------------------------------------------------------------------------------
Module Main
Dim i As Integer
Dim strUser As String = Mid(System.Secu rity.Principal. WindowsIdentity .GetCurrent().N ame(), System.Security .Principal.Wind owsIdentity.Get Current().Name( ).IndexOf("\") + 2).ToUpper
Dim objKategorien() As Kategorie
Const strDB As String = "D:\Dokumen te und Einstellungen\M arkus\Eigene Dateien\Visual Studio Projects\ResSol ution-Zaehler\ResSolu tion-Zaehler.mdb"
Public Sub Main()
ReadDB()
End Sub
'Kategorien und akt. Zählerstand aus Access-Datenbank auslesen
Private Sub ReadDB()
Dim connDB1 As New OleDb.OleDbConn ection("Provide r=Microsoft.Jet .OLEDB.4.0;Data Source=" & strDB)
Dim connDB2 As New OleDb.OleDbConn ection("Provide r=Microsoft.Jet .OLEDB.4.0;Data Source=" & strDB)
Dim cmdDB1 As New OleDb.OleDbComm and("SELECT * from Kategorien", connDB1)
Dim cmdDB2 As New OleDb.OleDbComm and("SELECT Zaehlerstaende. Kategorie, Zaehlerstaende. Minuten, Zaehlerstaende. OK FROM(Zaehlersta ende) WHERE (Zaehlerstaende .[User-Kuerzel]='" & strUser & "')
and (Zaehlerstaende .Datum=Date())" , connDB2)
Dim drDB1 As OleDb.OleDbData Reader
Dim drDB2 As OleDb.OleDbData Reader
connDB1.Open()
drDB1 = cmdDB1.ExecuteR eader()
i = 0
Do While drDB1.Read()
ReDim Preserve objKategorien(i )
objKategorien(i ) = New Kategorie
objKategorien(i ).ID = drDB1.Item("ID" )
objKategorien(i ).Bezeichnung = drDB1.Item("Bez eichnung")
connDB2.Open()
drDB2 = cmdDB2.ExecuteR eader()
Do While drDB2.Read
If (objKategorien( i).ID = drDB2.Item("Kat egorie")) And (drDB2.Item("OK ") = False) Then
objKategorien(i ).Minuten = drDB2.Item("Min uten")
End If
Loop
drDB2.Close()
connDB2.Close()
i = i + 1
Loop
drDB1.Close()
connDB1.Close()
End Sub
End Module
----------------------------------------------------------------------------------------------
Public Class Kategorie
Public ID As Long
Public Bezeichnung As String
Public Minuten As Integer
End Class
----------------------------------------------------------------------------------------------
It is working very well but do I have to open and close the drDB2 every time?
And why is it not working only with connDB1? I have to Dim connDB2, too, because the compiler says: Dieser Verbindung ist bereits ein geöffneter DataReader zugeordnet, der zuerst geschlossen werden
muss. (The connection is already set to a DataReader witch has to be closed first).
Is there a better way to get the data. Is there something like a DataSet where I can store the result?
Please help me.
Thx, Markus Ellebrecht
P.S. I am german and my english might not be the best. So please foregive me my mistakes *g* 6 1185
Hi Markus!
"Markus Ellebrecht" schrieb 'Kategorien und akt. Zählerstand aus Access-Datenbank auslesen
Oh my god! Everything in german ;-)
Is there a better way to get the data. Is there something like a DataSet where I can store the result?
DataReader is read-only, forward-only. Have a look at System.Data.Dat aSet:
Tutorial (in german) http://www.microsoft.com/germany/ms/...?siteid=542640
Documentation (in german): http://msdn.microsoft.com/library/de...ClassTopic.asp
P.S. I am german and my english might not be the best. So please foregive me my mistakes *g*
There is a german newsgroup as well:
news:microsoft. public.de.germa n.entwickler.do tnet.vb
for ADO.NET
news:microsoft. public.de.germa n.entwickler.do tnet.datenbank
Cheers
Arne Janning
Markus,
First a question, are you using VBNet with a Visual.Studio Net IDE or with a
Notebook, the last can make it for you a lot more difficult however not
impossible.
For both is a very good page how to do it. http://samples.gotdotnet.com/quickstart/
In VBNet (certainly with ASPNET) you can forget the module.
You connect your page to your code using a string on the page, however how
to do it depends very much if you use the IDE which does it automaticly or a
notebook or whatever and the VBC compiler. (For me it seems a very hard way
to go using that).
The way you see it in the quickstarts above is by the way again an other
method, because that is a kind of ASPX (VBNET) scripting.
Cor
Hello Arne,
thank u for your answer.
I will switch to the german groups *g*
I will watch your links and i hope it will help...
Greets, Markus Ellebrecht
On Sun, 17 Oct 2004 21:48:38 +0200, "Arne Janning" <sp************ *****@msn.com> wrote: Hi Markus!
"Markus Ellebrecht" schrieb
'Kategorien und akt. Zählerstand aus Access-Datenbank auslesen
Oh my god! Everything in german ;-)
Is there a better way to get the data. Is there something like a DataSet where I can store the result?
DataReader is read-only, forward-only. Have a look at System.Data.Dat aSet:
Tutorial (in german) http://www.microsoft.com/germany/ms/...?siteid=542640
Documentatio n (in german): http://msdn.microsoft.com/library/de...ClassTopic.asp
P.S. I am german and my english might not be the best. So please foregive me my mistakes *g*
There is a german newsgroup as well: news:microsoft .public.de.germ an.entwickler.d otnet.vb
for ADO.NET news:microsoft .public.de.germ an.entwickler.d otnet.datenbank
Cheers
Arne Janning
Arne,
I did not see this, I will see the reaction of Herfried when this question
comes in his most own particular newsgroup. news:microsoft. public.de.germa n.entwickler.do tnet.vb
:-))))
Cor
Markus,
I did mean notepad because your code did look like it was typed in a notepad
for me.
There is an ASPNET resourcekit in those is a lot of usefull information,
extra controls and quickstart, maybe you can take that as sample. Better
you take now I know you have Visual Studio Net that you take this one. http://msdn.microsoft.com/asp.net/asprk/
With ASPNET you have to remember some things.
The response.redire ct is as well used to get the next page
The Session is still and even more important (you eveb can put a dataset in
one time in it)
ASPNET is stateless, what means that nothing is saved between sending and
getting back unless you put it in a session between the send and the
postback
I wrote it the postback, that is important.
The load event is forever fired. In that you have to use the statement.
If Not Ispostback then
Else
End if
Beside the session is the viewstate (everything is sended everytime), a
shared class however that is for the application what means for all users
active on your server in a session and as well the cache what is almost the
same as a shared cache and therefore usefull, however wait untill you need
that.
I think I have give you for now enough information.
I hope this helps somehow?
Cor
I hope this helps a little bit?
Cor
Hi Cor!
"Cor Ligthert" schrieb There is an ASPNET resourcekit in those is a lot of usefull information, extra controls and quickstart, maybe you can take that as sample. Better you take now I know you have Visual Studio Net that you take this one.
http://msdn.microsoft.com/asp.net/asprk/
With ASPNET you have to remember some things.
The response.redire ct is as well used to get the next page
Keep in mind that may as well be used to get the previous page.
The Session is still and even more important (you eveb can put a dataset in one time in it)
Actually every web server can have multiple sessions. So there is not "The
Session" there are "Sessions". I think this is to improve performance.
ASPNET is stateless, what means that nothing is saved between sending and getting back unless you put it in a session between the send and the postback
HTTP is stateless as it has been specified by a supra-natinal commitee.
ASP.NET has been built in building 42, Bellvue, Washington, USA and
therefore might not be stateless.
I wrote it the postback, that is important.
Full ACK.
The load event is forever fired. In that you have to use the statement.
If Not Ispostback then
Return ToSender
Beside the session is the viewstate (everything is sended everytime), a shared class however that is for the application what means for all users active on your server in a session and as well the cache what is almost the same as a shared cache and therefore usefull, however wait untill you need that.
I hope this helps a little bit?
A little bit, yes, thanks. You know, germans...
Cheers
Arne This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gonçalo Rodrigues |
last post by:
Hi,
I have a problem with threads and sockets. I'll try to describe the
problem in words with pseudo-code.
I've been working on a few classes to make it easier to work with
threads. This framework, let us call it that, consists in two parts.
The first part is just a basic thread class deriving from
threading.Thread with a few extra functionality that makes it easier
for a thread to spawn a new thread and "father it". Each of its
|
by: crawlerxp |
last post by:
This is the problem: I do not get the output I need when encoding and
decoding data using rijndael alghoritm.
Look at the code and see what the problem is actually:
Please paste this code into your Visual Studio and compile it + run it; so
you can see what the actual problem is.
Thanks.
code:
|
by: Bob Greschke |
last post by:
We have some equipment that communicates at 57600 baud RS232. The path from
the PC is USB to a Phillips USB hub, then off of that a TUSB3410 USB/Serial
converter. The driver for the 3410 chip creates a "normal" comm port (like
COM3). There is a C++ program that has no problem talking to the equipment,
but two Python programs have trouble. One is a big, scary, controller
program, and the other, since that is the one I'm having trouble...
|
by: c duden |
last post by:
I am attempting to encrypt some text and be able to decrypt it at a later
time. I have two methods to do this:
public static Byte EncryptText(string textToEncrypt, string
encryptionHash)
{
Byte bytearrayinput =
StringAndByteManipulation.ConvertStringToByteArray(textToEncrypt);
//DES instance
System.Security.Cryptography.TripleDESCryptoServiceProvider des = new
|
by: Abhishek |
last post by:
I have a problem transfering files using sockets from pocket pc(.net compact
c#) to desktop(not using .net just mfc and sockets 2 API). The socket
communication is not a issue and I am able to transfer data across.On the
serve I am using Socket 2 API (recv function to read bytes)and not using
..NET. I use FileStream to open the file on the pocket pc, then associate a
BinaryReader object with the stream and call ReadBytes to read all the...
| |
by: Lokkju |
last post by:
I am pretty much lost here - I am trying to create a managed c++
wrapper for this dll, so that I can use it from c#/vb.net, however, it
does not conform to any standard style of coding I have seen. It is
almost like it is trying to implement it's own COM interfaces...
below is the header, and a link to the dll+code:
Zip file with header, example, and DLL:...
|
by: Nathan Sokalski |
last post by:
I am trying to connect to a Microsoft Access Database from my ASP.NET
Application. I use the following code to create my connection string:
cmdSelect.Connection = New
System.Data.OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATASOURCE="
& Server.MapPath("/WebApplication1/nathansokalski_com.mdb"))
Although the error does not occur until the Fill() method is called:
|
by: Scott M. Lyon |
last post by:
I've just discovered a bug in some code I wrote a little while ago, and I
need you guys' help to fix it.
My program imports data from a standard Excel Spreadsheet (just with
specific column headers). I used ODBC in my VB.NET program to read that
spreadsheet into a dataset, to make it easy to manipulate. The code I use to
read it is as the bottom of this posting.
|
by: efrenba |
last post by:
Hi,
I came from delphi world and now I'm doing my first steps in C++. I'm
using C++builder because its ide is like delphi although I'm trying to
avoid the vcl.
I need to insert new features to an old program that I wrote in delphi
and it's a good opportunity to start with c++.
|
by: John |
last post by:
Hi
This .net is driving me crazy!!
In VB6 I had a type which contained a couple of multi-dimentional arrays
which i used to create and read records:
Type AAA
:
Array1(10,10,2) as Integer
|
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...
| |
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: 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: 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,...
|
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: 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...
|
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: 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...
| |