|
norm wrote:
With all due respect, VB.NET seems to have it all:
LOL - yeah, that's it......
norm wrote:
better code samples and documentation
Ya. You see, C++ programmers are smart enough to convert from VB samples to C++ on the fly, so often things are only documented in VB.
norm wrote:
speed - not slower than VC.NET isnt it (since all compile to IL)?
Wrong - C++ IL is actually optimised. Microsoft made a big deal of this to try and get C++ programmers to subject their code to an intermediate runtime.
norm wrote:
best dialog editor
I'll give you this, although I'm told only until Feb.
norm wrote:
ease of use (and now it's multithreaded + object oriented)
This is subjective. I am using VB at work and I think it's a pig of a thing.
norm wrote:
most likely to attract a large user base?
Not a chance in hell. C# is where the action is.
norm wrote:
VC seems like an obsolete tool.
norm wrote:
well, a low level dev tool perhaps (where u want to create buffer overflow).
Well, just because you've never had to be smart enough to manage any memory does not mean a C++ program, properly written, should have a chance in hell of having a buffer overflow. None of my code has or will ever suffer from this problem. You're thinking of C.
norm wrote:
And VB.NET seems like to be the tool that get the job done and done fast.
Getting the job done fast, and barely adequately, has always been VB's claim to fame. But why do you think we have C# ? Because even if VB ever turns into a real programming language ( and with .NET it's probably close, seeing as they all target the same IL ), the name of VB is beyond repair, it has been associated with too many crappy hack programmers writing too much bad code for too long. C# will replace VB within a couple of years. Already C# has a fair bit over VB.NET ( I know you read that thread, so I won't link to it ), and with more to come, Microsoft are trying to channel both real programmers, and VB heads into using C#.
norm wrote:
according to code project and code guru forums membership statistics, it seems VC6 is still a much more popular/dominant development tool. but perhaps this is because codeguru and codeproject are both C++ sites?
I've read a bit from VB programmers who hate VB.NET because it has changed so much that they cannot wrap their heads around it. However, at work we still use a lot of VC6, because we work on legacy code and I don't see why the VB world would be any different.
norm wrote:
any good sites for VB/VB.NET forums? downloads/tutorials?
Try here.[^]. Seriously, I don't know, but if you're at the learning stage, you're making a serious mistake if you target VB.NET. If you don't intend on ever doing any serious programming where performance counts, I'd be going for C# all the way.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
"I'll give you this, although I'm told only until Feb."
> what? in feb we'll get a dialog editor for VC?
norm
|
|
|
|
|
I believe that is part of the next version, yes.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
thanks, good to know.
norm
|
|
|
|
|
norm wrote:
a. better code samples and documentation...
I have noticed this too. Allthough I honestly don't spend alot of time looking for code examples of things done in C++, I just don't see the amount of examples that I do for VB.
norm wrote:
b. speed - not slower than VC.NET isnt it (since all compile to IL)?
Again, I have to go by experiance here. I ran some tests way back using VB6 and VC6 and VC was faster at most things. However, when I looked at the differences in speed for what I was using it for VS. the knowledge that I already had vested in VB6, VB won hands down. I was not writing timing critical code, nor was a writing anything that HAD to be done tight. When I DID have an occasion to do something time critical I wrote a DLL and called it from VB.
I have not done any comparisons in .NET between the two, but I stil belive that VC will be a bit (albeit maybe not too much) fatser than VB.NET/C#
norm wrote:
c. best dialog editor
Hands down here I think you are right. I have not seen Everrett (sp) but I think this has been one of the things that have made VB and C# a very attractive language for most developers. I hate using VC resources to design dialog boxes, and MFC always seemed like a PITA to me. I like being able to address a text boxes text by using TextBox1.Text.
norm wrote:
d. ease of use (and now it's multithreaded + object oriented)
I am a firm lover of VB (so I have to admit that I AM Biased here). VB finally got the shot of steriods that it neded to compete with the other languages.
norm wrote:
e. most likely to attract a large user base?
I really disagree with this one though. I think in the long run C# will be the langauge of choice for most new developers. I ahev to admit that VB seems like it was only included in .NET because of the years of legacy code that is already in place for alot of companies. Allthough I still firmly belive that VB is a first class language, I can see the handwriting on the wall that says that things are progressing and that C# is the way to go from now on.
Does that mean that I am dropping VB all together? NOPE, not on your life. But new things that are intended to be wround for the long term will be done in C#.
Hope this helps.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
|
|
|
|
|
What A** decided to make collection items start at index 1 and arraylist items start at index 0?
Is it this way in C#?
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
|
|
|
|
|
I believe from something I read in a magazine this week that VB has always had 1 indexing, and certainly ArrayList, as it is part of the .NET Framework, does it properly and starts at 0.
I have to use VB at work at the moment. I feel so dirty.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian Graus wrote:
I believe from something I read in a magazine this week that VB has always had 1 indexing
Yeah, but there used to be a way to force it to use 0 based indexing... Looks like like that is gone now... This is just one of those annoying things that makes VB seem.. Oh, I don't know...
I guess I will use 'odd' for lack of a better (more PC) term at the moment. Don't get me wrong, I love VB because I am used to it...
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
|
|
|
|
|
Christian Graus wrote:
I have to use VB at work at the moment. I feel so dirty.
I have a feeling this will appear as someone's signature soon. CG, so you are using VB at work now?
Nick Parker
Not everything that can be counted counts, and not everything that counts can be counted. - Albert Einstein
|
|
|
|
|
I've always had to use it from time to time, I hate VB from exposure to it, not from assumptions or because it's trendy to do so. Right now we are writing a COM dll to bridge ASP and ASP.NET sessions and VB simply makes sense because to do so in C++ would be so much more verbose. I still would have done it in C++, but my boss presented a 60% done project in VB.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian Graus wrote:
VB simply makes sense because to do so in C++ would be so much more verbose.
I never thought I would hear/read you utter those words, however I do have to agree as to do somethings in VB are much faster than C++, however there are many things as I am learning that can be done in C++ that just can't be done in VB.
Nick Parker
Not everything that can be counted counts, and not everything that counts can be counted. - Albert Einstein
|
|
|
|
|
Nick Parker wrote:
however there are many things as I am learning that can be done in C++ that just can't be done in VB.
Absolutely. I have to write my own linked list because VB does not provide one. How is that remotely a programming language ? But as I said, if I had started it, I would have done it in C++. We still haven't figured out how to debug our dll. And the syntax is just crap. There are so many examples of design with no thought for the consequences, it's really quite frustrating.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
That only applies to the Collection class in the Microsoft.VisualBasic namespace, and is there for backwards compatability with VB6. If you use one of the classes from the System.Collections or System.Collections.Specialized namespaces, the indexing starts at 0.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Does anyone out there know if there is a limit on the ASP.NET cache object ?? I have'nt been able to find anything. Any info would be greatly appreciated.
Thanks
Bill Riegert
infoGenius.com
brieg1000@msn.com
|
|
|
|
|
Sorry, can't help you there. I just started learning asp.net myself.
Anyway, wouldn't you get better answers at the ASP.Net board?
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
I am writing a VISUAL BASIC(VB.NET) application that will utilize the ASP.NET cache.
See your second quote !!
|
|
|
|
|
Hi there - I'm busy with a project that uses an Access 2000 database with VB6. It uses a DSN to connect, and I have the following problem: on one of the test machines, and I'm sure on the many machines it has to be compatible on, the ODBC drivers for Access 2k aren't available, only Access97 drivers. This is a problem because of the way the DB works (it doesn't in 97 format ), so does anyone know where (on ms.com maybe) i can find an updater for a system's ODBC drivers? I haven't found anything that makes sense. Or maybe one of you has another solution?
Thanks
Paul W
-- A wise fox has many exits from its burrow.
modified 18-Jul-18 11:59am.
|
|
|
|
|
You need to download the latest version of MDAC[^].
Paul van der Walt wrote:
Or maybe one of you has another solution?
Use a decent DBMS like SQL Server, or, if you can't afford it, use MSDE.
I see dumb people
|
|
|
|
|
Hi there,
i have a project with many forms and with many dataadapter, SqlCommand´s, and SqlConnection´s generated from the assistend.
Now is if i insert more and more the speed between changing the form´s
increased and all will work slower and slower.
Every Dataadapter, SQLConnection, etc. try to connect. Can stop the automaticaly connecting in the DOTNET GUI.
I know the connection programming in code is faster but is their a solution.
THX
supi
|
|
|
|
|
Sure, you need to redesign everything! First, you should start by creating simple DataAccess components. I like to do this in a standalone DLL which I can use for all my Projects.
Within the DLL, I have a public Class call "DataSource". I encapsulate ALL Connection information here and make it super simple to use. For example, "DataSource.Connect", "DataSource.DisConnect" and all error handling is done within the Class.
Now, within my "Central" project, I create 1 Public Variable (or Shared Variable in VB.NET) and place it either inside a Globals Module (in VB6) or within the MDIForm (in VB.NET as a Shared Variable). Doing this allows all my Forms to use 1 Connection link into the Database.
I will Post next the DataSource Class which I use. It is very simple to use, here's an Example:
'Initialize the Application
MainMDI.DataSource = New ActiveDataObjects.DataSource()
With MainMDI.DataSource
.DatabaseType = ActiveDataObjects.DataSource.DatabaseTypes.dbSQLServer
.Server = "(Local)"
.Database = "MyDatabase"
.UserID = "UserID"
.Password = "password"
End With
The DataSource automatically knows when to initialize a Connection if one doesn't already exist, and it knows how to Connect / DisConnect using the Proper IDBConnection Object optimized for the "DatabaseType" specified. I have Connection strings implemented for almost all DBTypes, but more can be simply Implemented by editing the DatabaseType enum and modifiying the Code (look for ConnectionStrings on www.connectionstrings.com).
|
|
|
|
|
Here's the DataSource Class:
Option Strict On
Option Explicit On
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
'Imports
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports Microsoft.Data.Odbc
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
'Class to encapsulate Data Access
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
Public NotInheritable Class DataSource
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
#Region "Declarations"
'Implementations
Implements IDisposable
'Enumerations
Public Enum DatabaseTypes
dbAccess
dbExcel
dbODBC
dbFileDSN
dbSQLRemote
dbSQLServer
dbSybase5
dbSybase6
dbSybase7
End Enum
Public Enum SQLProtocols
sqlNamedPipes
sqlTCPIP
sqlSPXIPX
sqlBanyanVines
sqlRPC
End Enum 'When connecting through the SQLOLEDB provider use the syntax Network Library=dbmssocn and when connecting through MSDASQL provider use the syntax Network=dbmssocn
Public Enum SecuirtyProtocols
StandardSecurity = 0
TrustedSecurity = 1
End Enum
'Property Variables
Private _Server, _RemoteServer, _Database, _DSN, _Address, _ConnectString As String
Private _User, _Password As String
Private _TimeOut, _Port As Integer
Private _UseIntegrated, _UsePrompt As Boolean
Private _Type As ActiveDataObjects.DataSource.DatabaseTypes
Private _Protocol As ActiveDataObjects.DataSource.SQLProtocols
Private _Security As ActiveDataObjects.DataSource.SecuirtyProtocols
'Variables
Private odbcCon As Microsoft.Data.Odbc.OdbcConnection
Private odbcAdapter As Microsoft.Data.Odbc.OdbcDataAdapter
Private oleCon As System.Data.OleDb.OleDbConnection
Private oleAdapter As OleDb.OleDbDataAdapter
Private sqlCon As System.Data.SqlClient.SqlConnection
Private sqlAdapter As SqlClient.SqlDataAdapter
Private bConnected, bDisposed As Boolean
#End Region
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
#Region "Properties"
'Property to Return the Connection Object
Public ReadOnly Property Connection() As System.Data.IDbConnection
Get
If (IsNothing(_ConnectString)) OrElse (_ConnectString.Length = 0) Then Exit Property
If (Not bConnected) Then Call Me.Connect() 'Determine if Connected
Select Case _Type
Case DatabaseTypes.dbAccess : If (Not oleCon Is Nothing) Then Connection = oleCon Else Return Nothing
Case DatabaseTypes.dbExcel : Return Nothing
Case DatabaseTypes.dbODBC : If (Not odbcCon Is Nothing) Then Connection = odbcCon Else Return Nothing
Case DatabaseTypes.dbSQLServer : If (Not sqlCon Is Nothing) Then Return sqlCon Else Return Nothing
Case DatabaseTypes.dbSybase5 : If (Not oleCon Is Nothing) Then Connection = oleCon Else Return Nothing
Case DatabaseTypes.dbSybase6 : If (Not oleCon Is Nothing) Then Connection = oleCon Else Return Nothing
Case DatabaseTypes.dbSybase7 : If (Not oleCon Is Nothing) Then Connection = oleCon Else Return Nothing
End Select
End Get
End Property
'PropertytoReturn the Connection String
Public ReadOnly Property ConnectionString() As String
Get
Return _ConnectString
End Get
End Property
'Property for the Database
Public Property Database() As String
Get
Return _Database
End Get
Set(ByVal Value As String)
If (Not IsNothing(_Database)) Then If (_Database.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_Database = Value
Call Me.RefreshConnectionString()
End Set
End Property
'Property for the Database Type
Public Property DatabaseType() As DatabaseTypes
Get
Return _Type
End Get
Set(ByVal Value As DatabaseTypes)
If (_Type.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_Type = Value
Call Me.RefreshConnectionString()
End Set
End Property
'Property to Return whether the Connection is Open
Public ReadOnly Property IsConnected() As Boolean
Get
Return bConnected
End Get
End Property
'Property for the Password
Public Property Password() As String
Get
Return _Password
End Get
Set(ByVal Value As String)
If (Not IsNothing(_Password)) Then If (_Password.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_Password = Value
Call Me.RefreshConnectionString()
End Set
End Property
'Property for the Server
Public Property Server() As String
Get
Return _Server
End Get
Set(ByVal Value As String)
If (Not IsNothing(_Server)) Then If (_Server.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_Server = Value
Call Me.RefreshConnectionString()
End Set
End Property
'Property for the SQL Server Port
Public Property ServerPort() As Integer
Get
Return _Port
End Get
Set(ByVal Value As Integer)
If (_Port.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_Port = Value
Call Me.RefreshConnectionString()
End Set
End Property
'Property for the Security Protocol
Public Property SecurityProtocol() As SecuirtyProtocols
Get
Return _Security
End Get
Set(ByVal Value As SecuirtyProtocols)
If (_Security.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_Security = Value
Call Me.RefreshConnectionString()
End Set
End Property
'Property for User Prompting
Public Property UsePrompt() As Boolean
Get
Return _UsePrompt
End Get
Set(ByVal Value As Boolean)
If (_UsePrompt.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_UsePrompt = Value
Call Me.RefreshConnectionString()
End Set
End Property
'Property for the User ID
Public Property UserID() As String
Get
Return _User
End Get
Set(ByVal Value As String)
If (Not IsNothing(_User)) Then If (_User.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_User = Value
Call Me.RefreshConnectionString()
End Set
End Property
#End Region
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
#Region "Methods"
'Function to Connect
Public Function Connect() As Boolean
Dim mServer As ActiveSystemObjects.Network.Server
Dim sMsg As String
Dim bServerExists As Boolean
Dim i As Integer
'Verify that there is enough info to Connect
If (IsNothing(_ConnectString)) OrElse (_ConnectString.Length = 0) Then Return False
If (bConnected) Then Return True 'Determine if the Connection already Open
'Determine if the Server is available
Try
If (Not IsNothing(_Server)) AndAlso (_Server.Length > 0) Then
mServer = New ActiveSystemObjects.Network.Server(_Server)
If (mServer.Exists) Then _Address = mServer.IPAddress : bServerExists = True
End If
Catch
Call Globals.ErrorMessage("DataSource.Connect")
Finally
mServer = Nothing
End Try
If (Not bServerExists) Then Return False
Try
Select Case _Type
Case DatabaseTypes.dbAccess, DatabaseTypes.dbExcel, DatabaseTypes.dbSQLRemote, DatabaseTypes.dbSybase6, DatabaseTypes.dbSybase7
Try
oleCon = New OleDb.OleDbConnection(_ConnectString)
oleCon.Open()
bConnected = (oleCon.State = ConnectionState.Open)
Catch
Call Globals.ErrorMessage("DataSource.Connect")
oleCon.Dispose() : oleCon = Nothing
bConnected = False
End Try
Case DatabaseTypes.dbODBC
Try
odbcCon = New OdbcConnection(_ConnectString)
odbcCon.Open()
bConnected = (odbcCon.State = ConnectionState.Open)
Catch
Call Globals.ErrorMessage("DataSource.Connect")
odbcCon.Dispose() : odbcCon = Nothing
bConnected = False
End Try
Case DatabaseTypes.dbSQLServer
Try
'Open the SQL Connection
sqlCon = New SqlClient.SqlConnection(_ConnectString)
sqlCon.Open()
bConnected = (sqlCon.State = ConnectionState.Open)
Catch
Call Globals.ErrorMessage("DataSource.Connect")
sqlCon.Dispose() : sqlCon = Nothing
bConnected = False
End Try
End Select
Catch Excp As SystemException
Call Globals.ErrorMessage("DataSource.Connect")
End Try
Return bConnected
End Function
'Routine to DisConnect
Public Sub DisConnect()
'Determine if there is a Connection String
If (IsNothing(_ConnectString) OrElse (_ConnectString.Length = 0)) Then Exit Sub
If (Not bConnected) Then Exit Sub 'Determine if Connected
'Destroy any SQL Connections
If (Not sqlCon Is Nothing) Then sqlCon.Close() : sqlCon.Dispose()
sqlCon = Nothing
'Destroy any OLEDB Connections
If (Not oleCon Is Nothing) Then oleCon.Close() : oleCon.Dispose() : oleCon.ReleaseObjectPool()
oleCon = Nothing
'Destroy any OLEDB Connections
If (Not odbcCon Is Nothing) Then odbcCon.Close() : odbcCon.Dispose() : odbcCon.ReleaseObjectPool()
oleCon = Nothing
bConnected = False
End Sub
'Function to Load an Adapter from a Configuration
Public Function LoadAdapter(ByVal ConfigPath As String, ByVal AdapterName As String, Optional ByVal Version As String = "1.0") As Data.Common.DataAdapter
Dim IAdapter As Data.IDbDataAdapter
Dim xDoc As New Xml.XmlDocument()
Dim xAdapter, xCommand, xParam As Xml.XmlNode
'Determine if the File Exists
If (Not IO.File.Exists(ConfigPath)) Then Return Nothing
'Open the BusinessObject Configuration
xDoc.Load(ConfigPath)
xAdapter = xDoc.SelectSingleNode("//DataAdapter[@Name = '" & AdapterName & "'][@Version = '" & Version & "']")
For Each xCommand In xAdapter.ChildNodes
'Determine the Type of Command
Select Case CType(xCommand.Attributes("StatementType").Value, Data.StatementType)
Case StatementType.Select
With IAdapter.SelectCommand
.CommandType = CType(CInt(xCommand.Attributes("CommandType").Value), Data.CommandType)
.CommandText = xCommand.Attributes("Text").Value
.CommandTimeout = CInt(xCommand.Attributes("TimeOut").Value)
End With
Case StatementType.Insert
Case StatementType.Update
Case StatementType.Delete
End Select
Next
End Function
'Routine to Refresh the Connection String
Private Sub RefreshConnectionString()
Dim sProvider As String
Dim sProperties As New Text.StringBuilder()
Select Case _Type
Case DatabaseTypes.dbAccess 'Access Databases
If (Not IsNothing(_Database)) AndAlso (_Database.Length > 0) Then
sProperties.Append("Provider=Microsoft.Jet.OLEDB.4.0")
sProperties.Append(";Data Source=" & _Database)
If (Not IsNothing(_User)) AndAlso (_User.Length > 0) Then sProperties.Append(";User ID=" & _User)
If (Not IsNothing(_Password)) AndAlso (_Password.Length > 0) Then sProperties.Append(";Password=" & _Password)
End If
Case DatabaseTypes.dbExcel 'Excel Spread Sheets
If (Not IsNothing(_Database)) AndAlso (_Database.Length > 0) Then
sProperties.Append("Provider=Microsoft.Jet.OLEDB.4.0")
sProperties.Append(";Data Source=" & _Database)
sProperties.Append(";Extended Properties=Excel 8.0")
'sProperties.Append(";HDR=Yes") 'First Row has Column Names
End If
Case DatabaseTypes.dbODBC 'ODBC Data Sources
If (Not IsNothing(_DSN)) AndAlso (_DSN.Length > 0) Then
sProperties.Append("DSN=" & _DSN)
If (Not IsNothing(_User)) AndAlso (_User.Length > 0) Then sProperties.Append(";UID=" & _User)
If (Not IsNothing(_Password)) AndAlso (_Password.Length > 0) Then sProperties.Append(";Password=" & _Password)
End If
Case DatabaseTypes.dbSQLServer 'SQL Server
If ((Not IsNothing(_Server)) AndAlso (_Server.Length > 0)) AndAlso ((Not IsNothing(_Database)) AndAlso (_Database.Length > 0)) Then
sProperties.Append("Data Source=" & _Server)
sProperties.Append(";Initial Catalog=" & _Database)
'Determine the Protocol to use
'Select Case _Protocol
' Case SQLProtocols.sqlBanyanVines : sProperties.Append(";Network Library=DBMSVINN")
' Case SQLProtocols.sqlNamedPipes : sProperties.Append(";Network Library=DBNMPNTW")
' Case SQLProtocols.sqlRPC : sProperties.Append(";Network Library=DBMSRPCN")
' Case SQLProtocols.sqlSPXIPX : sProperties.Append(";Network Library=DBMSSPXN")
' Case SQLProtocols.sqlTCPIP : sProperties.Append(";Network Library=DBMSSOCN")
'End Select
'sProperties.Append(";Connection Timeout=" & _TimeOut)
'Determine the Security to Use
If (_Security = SecuirtyProtocols.TrustedSecurity) Then
sProperties.Append("Integrated Security=SSPI")
Else
If (Not IsNothing(_User)) AndAlso (_User.Length > 0) Then sProperties.Append(";User ID=" & _User)
If (Not IsNothing(_Password)) AndAlso (_Password.Length > 0) Then sProperties.Append(";Password=" & _Password)
End If
End If
Case DatabaseTypes.dbSybase5
Case DatabaseTypes.dbSybase6
Case DatabaseTypes.dbSybase7
End Select
_ConnectString = sProperties.ToString
sProperties = Nothing
End Sub
#End Region
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
#Region "Class Methods"
'Initialize Class
Public Sub New()
_Type = DatabaseTypes.dbSQLServer
_Port = 1433
End Sub
'Initialize for Access Database
Public Sub New(ByVal Database As String, ByVal UserID As String, ByVal Password As String)
_Type = DatabaseTypes.dbAccess
_Database = Database
_User = UserID
_Password = Password
Call Me.RefreshConnectionString()
End Sub
'Initialize for SQL Server
Public Sub New(ByVal Database As String, ByVal Server As String, ByVal UserID As String, ByVal Password As String)
_Type = DatabaseTypes.dbSQLServer
_Server = Server
_Database = Database
_User = UserID
_Password = Password
_Port = 1433
Call Me.RefreshConnectionString()
End Sub
'Initialize for DSN
Public Sub New(ByVal DSN As String)
_Type = DatabaseTypes.dbODBC
_DSN = DSN
Call Me.RefreshConnectionString()
End Sub
'Routine to Dispose
Public Sub Dispose() Implements IDisposable.Dispose
If (Not bDisposed) Then
bDisposed = True
Call Me.DisConnect()
If (Not IsNothing(odbcAdapter)) Then odbcAdapter.Dispose() : odbcAdapter = Nothing 'Destroy any ODBC Adapters
If (Not IsNothing(oleAdapter)) Then oleAdapter.Dispose() : oleAdapter = Nothing 'Destroy any OLEDB Adapters
If (Not IsNothing(sqlAdapter)) Then sqlAdapter.Dispose() : sqlAdapter = Nothing 'Destroy any SQL Adapters
GC.SuppressFinalize(Me)
End If
End Sub
'Routine to Finalize
Protected Overrides Sub Finalize()
MyBase.Finalize()
Call Dispose()
End Sub
#End Region
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
End Class
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
|
|
|
|
|
To make a Connection using this is simple.
Using "Option Strict":
Dim sqlCon As SQLClient.SQLConnection = Ctype(DataSource.Connection, SQLClient.SQLConnection)
Not using Option Strict:
Dim sqlCon As SQLClient.SQLConnection = DataSource.Connection
Even if you don't explicitly call "DataSource.Connect", the DataSource class knows it needs to make a Connection.
|
|
|
|
|
HI!
Is it possible to call a method (from a JAVA class) from a VB project??
When YES... please give me some examples.
thx!
|
|
|
|
|
I would use J# to compile a .NET version or JUMP to migrate it to C#.
Then, I would call it from VB.NET or try to expose it as a COM component to a VB 6.0 project.
I see dumb people
|
|
|
|
|
gicio wrote:
Is it possible to call a method (from a JAVA class) from a VB project??
Gosh, is it not possible to port the Java code to another language? Hmm, well in any case, have you tried to add a reference to it in VB? I am not sure of the COM support that Java has built into it directly.
Nick Parker
|
|
|
|
|