Create A Class Or Module To Easily Connect To One Of Many Databases?

Jun 11, 2012

Basically, we have three databases to grab data from. One is a SQL Server database, one is an Access database (which is particularly annoying to connect to because we have to map a network drive and such), and the final one will be an Oracle database when IT finally gives us rights.I'm thinking about creating a helper function that makes querying any one of these databases as easy as possible. I want to create a two-dimensional array

Dim myEasyResultArray(10,10) as String
myEasyResultArray = DatabaseHelper("Access", "SELECT * FROM Employee")

Is this a good design decision? Also, how can I have the array be the right size? Can I just do this?

Dim myEasyResultArray = DatabaseHelper("Access", "SELECT * FROM Employee")

Should this be a module or a class? I don't really need to share variables?

View 2 Replies


ADVERTISEMENT

Create A Module That Will Contain All General SQL Functionality Like Connect - Disconnect And Execute A Sql Query

Sep 8, 2010

I'm fairly new to VB.NET and I'm looking to create a module that will contain all general SQL functionality like connect, disconnect and execute a sql query etc. I think I'm almost there but the code keeps bombing in one place. Can anyone see what is wrong with the following code?

[Code]...

View 1 Replies

Create A Control Class Rather Than Use A Module For MVC?

Mar 20, 2012

I'm trying to use it in writing VB.NET Windows Form code.So I'm thinking, instead of using a VB.NET module, or having code embedded in the forms, I should create my own "Control" Class, to handle all operations and "application" level variables.Is this the right approach?Ex:

Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
goControl = New MyControlClass()
goControl.sUserID = txtUser.text[code]....

View 1 Replies

VS 2005 Create Dataset In A Module And Call It In A Class?

Aug 7, 2009

This is my vb6 programme for creating recordset in a module. and call it in class
and form

[Code]...

View 4 Replies

Create Two Notepad Files: Module HelloWorld & Public Class Person?

Oct 6, 2009

i am working on the MSDN tutorials through virtual labs and am encountering a problem with the very first tutorial regarding consoles. I am required to create two notepad files: Module HelloWorld & Public Class Person which I have done without errors having triple checked them. When the files are created I compile the HelloWorld.vb file and a .exe is created

I follow the rest of the steps and encounter an error when i try to compile the Person.vb file using the line vbc Person.vb/t:library/out:HelloWorldLib.dll as i am getting the following errors:

vbc : Command line error BC2001 : file 'HelloWorld.vb/t:library/out:HelloWorldLib.dll' could not be found
vbc : Command line error BC2008 : no input sources specified

View 2 Replies

Connect And Query Between Two Sql Databases In Program?

Nov 18, 2010

I am trying to do a simple query of selecting an ID number from one table and matching it with the ID number in the other table, however the catch is the two tables are stored on two different sql databases.[code]...

View 5 Replies

Using VB 2005 To Connect And Search MS Access Databases?

Nov 22, 2009

I want to connect to a database Ive created using Microsoft Access 2007. Im using Visual Basic 2005. I also want to be able to perform basic tasks such as searching.

View 1 Replies

Connect To Previous Other Databases Such As SQL Server, Oracle. But Getting An Error?

Jul 5, 2011

I am trying to Connect my VB.net Window Application to IBM_DB2 Database.I have used the same method to connect to previous other databases such as SQL Server, Oracle. But getting an error in DB2.

Dim cn As New OdbcConnection("dsn=Sample;uid=db2admin;pwd=password") 'Sample is DSN

cn.Open()

Dim da As New OdbcDataAdapter("Select * from Employee", cn)[code]......

View 3 Replies

BGW In One Class And The Long Process For The BGW (DoWork) In Another Class Or Module?

Nov 16, 2009

I' ve got a short question concerning BackgroundWorker.Is it possible to have the main code for the BGW in one class and the long process for the BGW (DoWork) in another class or module?

I couldn't find anything helpful on the internet.Here is my code - DoWork in a separate class doesn't work:

[Code]...

View 15 Replies

Database Module In .net Will Allow To Connect To Both SQL Server And A MDF File?

May 18, 2012

Do you know which module in VB.net will allow me to connect to a file (mdf/mdb) and SQL Server (not at the same time but to change in runtime).Or do you know of two modules which have the same API?

I'm building software which I will wont work both locally and on a server. But I don't want to have to go changing all of my code just because I'm using a different modules. I know VB.net, but I've never used databases.There's so many different database connectors its confusing!

View 1 Replies

Add A Class And Get The Driver Module To Read From The Class?

Nov 13, 2009

What is a driver module, and how would I add a class and get the driver module to read from the class.

View 2 Replies

VS 2008 - Choose Data Source - User To Easily Create A Connection To Any Installed Data Types They Have Installed

Jun 1, 2011

I have been trying for days now how to create a process to the user to easily create a connection to any installed data types they have installed. I have found an example right inside vb2008. I never use this because I code my own connections, but this would be real nice if I could include it or duplicate it.

View 1 Replies

Create Access Databases Programmatically?

Jun 7, 2010

I need to make an application that from a master database creates a number of access database files (tables of a larger db), then these are manually given to users who fill in data, the database files are emailed back to a user who, through the application, combines them again.The only part of this that I am unsure about is problematically creating the access db's. I have read that through Microsoft Jet OLE DB Provider and Microsoft ADO Ext I can create them (the tables and data), but I also need forms.

View 1 Replies

Class - Use A .net Module?

Jan 12, 2011

Some of my co-workers make extensive use of the VB.net concept of Modules. Unfortunately, I just don't 'get it'. I see no benefit in using modules over shared classes. When would it be preferable to use a module?

View 2 Replies

Use A Class (DLL) Rather Than A Module?

Jun 17, 2012

Use a DLL rather than a module so that if I updated the DLL it would propagate over all the projects that used it. I want to create a library of functions and subroutines that may be used in many projects (such as my gradient and some error messages).

View 8 Replies

.net - Where To Keep A Structure: Class, Module Or None

Apr 18, 2011

This is purely a coding practice question concerning VB.NET structures. Where do you keep one?As an example, I've created a structure for the simple purpose of keeping information organized, I'd like this structure to be stand-alone, not belonging to any class so I wouldn't have to access it through SomeClass.MyStructure but rather simply MyStructure. So, do I keep it in a separate class and import it into my namespace? Do I keep it in a module (Static class, essentially)? Do I just make a separate VB.NET code file and place is there (I would like it to live in a separate file). Just to clarify, I need this structure to be accesses by the whole application, not just a single class.

View 1 Replies

Booleans In Module Class?

Mar 6, 2009

I'm working on a program that I have 90% finish.Its basically validates certain information such as credit card, telephone numbers, name etc...

Im trying to create a separate class 'IsValid'to figure out if the creditcard number is valid (is equal to 12 characters only).

This will be initiated with a "Validate button".I know how to do this in the mainform just using an If statement.

But I'm trying to figure out how to valid date this and return it to the form and possibly change cardnumber.forecolor = color.red

View 7 Replies

Class Can Do All The Jobs That A Module Can Do?

Sep 6, 2010

Recently i studied about Module and i think it is a Shared Class and all its members are Shared by default and we can not change that. I have query that is it doing something special that a class can not do ? I have just tried with a simple example and found that classes even do a Module's job.Below is my code:

[Code]...

View 7 Replies

Module / Class Won't Fetch

Aug 6, 2011

I got a problem with this piece of [code]...

The problem is that i want to move the >>dim dataLoad...<< to a different file (a config file), but when i move it, i get bunch of errors. And i do call the class/module but still it wont work.

Also the other question is how to download multiple files from a server, so when they are downloaded they stay/ are placed in the corresponding folder.

View 2 Replies

Replacing Module With Class?

Sep 11, 2011

I am using Joe Mayo's book Visual Studio 2010 A beginners guide and in it he suggests that the default Module Module1 should be replaced with a Class and that it was a hold over from previous versions of VS. How can I change VS's behavior so it defaults to Class Program instead?

View 4 Replies

Saving A Module And A Class?

Oct 31, 2010

Im going through the 2008 Express tutorials on methods and classes. Since the advantage of subs, functions, methods, etc is their reusability, how does one save them and later import them into an application?

Also when one writes a class, how is it tested without being part of a form? Besides testing a class, why would one wants to write a class without a form, if it is to be published for a user?

View 3 Replies

Would A Module Be More Suited Class

Nov 30, 2011

Currently i am using a class thats created and amended on startup and then passed as needed to other class constructors as needed. Now my project is around 20+ classes i am getting tired of passing each new instance this class. Would a module be more suited?

View 14 Replies

DB/Reporting :: Create Local Databases On The Light-side Of Things?

Jul 18, 2008

My boss wants me to create local databases on the light-side of things. I was researching on what solutions are available, we discussed the possibility of using text or xml files... but we dropped the idea since we want to use SELECT, UPDATE, DELETE command sets (or the like)I proposed the idea of using Access files (mdb) but he told me that he doesn't want the user to have Access installed on their computers.What are the choices avaible, am I forced to install Access on machines that would be using my VB .NET app to access mdb files?

View 2 Replies

Accessing And Using Array In Class Module

Mar 1, 2010

Any some simple examples of how arrays can be put in a Class Module? The examples should show how the array is used and accessed in a form.

View 3 Replies

Calling A Webpage From Within A Class Module?

Jun 1, 2009

I have been given an ASP.Net assignment at work because I had taken a few courses a couple of years ago. Currently, there are no ASP.Net programmers for me to ask here and I have searched several places (including Pro ASP Net book) to find a solution but have come up empty handed.

I have a class named spErrors which takes the values passed to it. Values passed include the offending page,function/sub, and other values and stores them in property values, then calls Response.Redirect("Errors.aspx") from the page's code behind page. In Errors.aspx, the values of the error/exception trapped in the Catch statement are displayed. This works fine from a web form. My question is, how do I call a web page from a class module?

Each class module has the ErrorHandler() procedure that passes these values to the class object. In the class, there is a Write Only property named Redirect and a method called Execute() which is used to display the error page if the error occurs in another class module. Since Response.Redirect() does not work in a class module, what namespace is needed in order for this to work?

Here is the code I'm using.

In the Catch block.
Catch ex As Exception
Err.Description = ex.Message
ErrorHandler(Err, "function name")

[code]....

View 2 Replies

Class Module For Multiple Buttons?

Jul 13, 2011

When loading the buttons to the class I keep getting the 'Null Reference Exception was unhandled' error. How can I fix it? Here is the code...

Class Module:

Public Class Buttons_Group_Class
Public WithEvents Button_Group As System.Windows.Forms.Button
Sub Button_Group_Click()

[code]....

View 7 Replies

Class Module Which Is Shared Between The 2 Projects?

Mar 29, 2010

I have no idea what is going on here but it is strange to say the least.I created a new solution in VS2008Pro under windows 7 This solution has 2 projects one for the pc and one for a CE based device.There is one class module which is shared between the 2 projects.In VS2005 under xp this same basic project worked fine but here I am seeing error messages that appear out of no where.

Example the CE portion flags 3 lines initially 1 related to a file i.o function and 2 others related to socket methods. All three of these were supported in VS2005 using framework 2.0 which is the same framework I am using here. This is just the tip of the ice berg however.If I attempt to run the code it runs fine for the pc client and of course not for the CE device. If I make any kind of change, add a line, comment a line or just add a comment I get lots more errors with odd messages that are not even valid.

In one case after I saved it jumped from 3 errors to 30, in another case to 50 and yet another to 144 errors yet the only errors that were present were the original 3 that were flagged.The ide threw errors like Try Catch must end with matching End Try.Get no longer supported ' apparently referring to the binary file get but here it is used as the get portion of the property.Get must end with matching end get.It also started complaining about functions and data types.For example saying "an is not declared" pointing to the word Boolean Or telling me my functions are not declared point to only 1/2 of the function name.

I do not see any errors in the code and it reports no errors in VS2005 under XP.As a test I tryed adding a new property to the project after it was telling me there were 144 errors. I allowed the ide to do most of the work and when I hit enter the errors went back to 3. Then I saved the project and the errors went to 105 pointing first at the new property just created.

View 5 Replies

Compiling A Class Module Into A .dll File

Feb 23, 2009

I want to know how can convert (compile) a class module into a .dll file. You can refer to me an article, tutorial or a code sample.

View 1 Replies

Convert A Module To Class Library?

May 21, 2011

I have a single solution with 2 projects. One project contains all my forms and some other modules and the other project has 1 module with 1 giant class in it. I try to click on properties and change the output type, but it won't let me make it a Class Library, the only 2 options are "Windows Application" or "Console Application". The startup object is the module, and the project has references to a socket component.

View 2 Replies

Converting A Static C# Class To VB Module?

Dec 3, 2009

I am trying to convert following code into a VB equivalent so that I can use it with threading my forms and controls.

using
System;
using
System.Collections.Generic;

[code]....

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved