Click here to Skip to main content
15,915,600 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionExcel Spreadsheet Control Pin
medicenpringles1-Oct-05 13:45
medicenpringles1-Oct-05 13:45 
AnswerRe: Excel Spreadsheet Control Pin
Anonymous2-Oct-05 23:59
Anonymous2-Oct-05 23:59 
AnswerRe: Excel Spreadsheet Control Pin
Suelinda_W7-Oct-05 9:29
Suelinda_W7-Oct-05 9:29 
QuestionHow do you get the index of the currently selected item in a listview? Pin
watagal1-Oct-05 13:26
watagal1-Oct-05 13:26 
AnswerRe: How do you get the index of the currently selected item in a listview? Pin
Anonymous1-Oct-05 13:45
Anonymous1-Oct-05 13:45 
AnswerRe: How do you get the index of the currently selected item in a listview? Pin
watagal3-Oct-05 4:41
watagal3-Oct-05 4:41 
QuestionNeed help connecting and suggestions Pin
erikkl20001-Oct-05 10:48
erikkl20001-Oct-05 10:48 
AnswerRe: Need help connecting and suggestions Pin
rwestgraham1-Oct-05 14:08
rwestgraham1-Oct-05 14:08 
OK, first of all, the reason why you would create a generic interface for data access is to hide the database implementation from your application.

For example, if you want to write a single front-end application that will work with both Access and SQL Server, then you wouold create generic interfaces like IConnection, IParameter, ICommand. Your application would work with these interfaces only.

Then you would have two families of classes, one for Access, one for SQL Server, that implement the common interfaces.

In your code, you are explicitly using the SqlClient family of data access. Now, there is absolutely nothing wrong with doing this. But there is no point in doing both - if you are going to explicitly bind your application to SQL Server, there is no point in going through interfaces.

Assuming you want to use interfaces, and not bind to a specific database type, you have to create implementation classes. As you point out, you cannot declare an Interface class as New. That is because the interface is only a definition. Instead what you need to do is create an implementation class that returns objects that implement the interfaces.

You never actually work with a SqlConnection. Instead you work through a custom class that entirely encapsulates the connection object for you.

This is difficult to explain.

There is a book, however, that has a full set of working examples for using indirect data access through interfaces:

Professional Design Patterns in VB.NET, by Fischer, et al. Published by a-Press. I think their code is available on the publishers website, but you really need the book to understand the concepts.
GeneralRe: Need help connecting and suggestions Pin
erikkl20001-Oct-05 14:12
erikkl20001-Oct-05 14:12 
GeneralRe: Need help connecting and suggestions Pin
rwestgraham1-Oct-05 15:53
rwestgraham1-Oct-05 15:53 
QuestionMore event troubles: SelectedIndexChanged Pin
watagal1-Oct-05 9:16
watagal1-Oct-05 9:16 
QuestionEvent: Treeview-AfterSelect Pin
watagal1-Oct-05 8:00
watagal1-Oct-05 8:00 
AnswerRe: Event: Treeview-AfterSelect Pin
watagal1-Oct-05 9:06
watagal1-Oct-05 9:06 
AnswerRe: Event: Treeview-AfterSelect Pin
Dave Kreskowiak1-Oct-05 13:48
mveDave Kreskowiak1-Oct-05 13:48 
Questionvb key lock Pin
ankur6111-Oct-05 7:52
ankur6111-Oct-05 7:52 
AnswerRe: vb key lock Pin
Dave Kreskowiak1-Oct-05 13:45
mveDave Kreskowiak1-Oct-05 13:45 
GeneralRe: vb key lock Pin
ankur6111-Oct-05 20:32
ankur6111-Oct-05 20:32 
GeneralRe: vb key lock Pin
Dave Kreskowiak2-Oct-05 2:05
mveDave Kreskowiak2-Oct-05 2:05 
QuestionHelp needed with BeginInvoke Pin
grambowk1-Oct-05 2:50
grambowk1-Oct-05 2:50 
QuestionForms in VB.NET Pin
Arfan Qadir30-Sep-05 19:09
Arfan Qadir30-Sep-05 19:09 
AnswerRe: Forms in VB.NET Pin
Gopi.V30-Sep-05 22:43
Gopi.V30-Sep-05 22:43 
GeneralRe: Forms in VB.NET Pin
alongi3-Oct-05 5:36
alongi3-Oct-05 5:36 
QuestionHow can i get the value of Mathematical Function at any point? Pin
Arfan Qadir30-Sep-05 19:04
Arfan Qadir30-Sep-05 19:04 
AnswerRe: How can i get the value of Mathematical Function at any point? Pin
Dave Kreskowiak1-Oct-05 3:11
mveDave Kreskowiak1-Oct-05 3:11 
QuestionReceive FAX Pin
Tad McClellan30-Sep-05 14:49
professionalTad McClellan30-Sep-05 14:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.