473,943 Members | 12,616 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

general db class, how to implement?

Hi!
I have a general db class (a normal class, that contains the functions and
subs to enable me to connect to my database) ok...
but, HOW??

Do, I make use of this class in my asp.net application...
I need to contact it from my codebehind page...
but, I contact my codebehind page with the src= tag, so it compiles when I
contact the webpage, and not before...

the class is also a normal vb.net class, so its called dbclass.vb

How do I make use of this class from my codebehindpage?

eg...
member.ascx - Control, that shows the db info...
member.ascx.vb - Codebehindpage. ..
.../classes/dbclass.vb - the dbclass that handles the db connection...

dbclass example function, that I need to be able to contact from the
chkuserEmail sub...
Public Function readRS(ByVal strQuery As String) As Object

End Function
the member.ascx.vb page contains a sub that for instance is going to check
the db for something:
'--Custom Validators--

Sub ChkuserEmail(so urce As object, args As ServerValidateE ventArgs)

How do I contact the readRS function from here???

End Sub
--
Kristoffer Arfvidson - kr********@arfv idson.se

Tel: +46 (0)733 - 442 660
Please visit us: www.arfvidson.se

Dansportalen - Nordens STÖRSTA webb om dans!
www.dansportalen.se (Finns nu på tre språk)
Nov 18 '05 #1
2 1536
On your code behind page you could do something like this... (aircode, not
tested)

private sub populateGrid()
Dim oDataClass as new dbclass
Dim sSql as String("Select * from Something")
myDataGrid.Data source = oDataClass.read RS(sSql)
myDataGrid.Data bind()
end sub

Not sure if you are using ado or ado.net here though - I think you need an
ado.net dataset or data reader for binding to web controls... if you are
planning to do that anyway.

--
Jerry Boone
Analytical Technologies, Inc.
http://www.antech.biz
Secure Hosting and Development Solutions for ASP, ASP.NET, SQL Server, and
Access
"Kristoffer " <kr********@ant ispam.com> wrote in message
news:ef******** ******@tk2msftn gp13.phx.gbl...
Hi!
I have a general db class (a normal class, that contains the functions and
subs to enable me to connect to my database) ok...
but, HOW??

Do, I make use of this class in my asp.net application...
I need to contact it from my codebehind page...
but, I contact my codebehind page with the src= tag, so it compiles when I
contact the webpage, and not before...

the class is also a normal vb.net class, so its called dbclass.vb

How do I make use of this class from my codebehindpage?

eg...
member.ascx - Control, that shows the db info...
member.ascx.vb - Codebehindpage. ..
../classes/dbclass.vb - the dbclass that handles the db connection...

dbclass example function, that I need to be able to contact from the
chkuserEmail sub...
Public Function readRS(ByVal strQuery As String) As Object

End Function
the member.ascx.vb page contains a sub that for instance is going to check
the db for something:
'--Custom Validators--

Sub ChkuserEmail(so urce As object, args As ServerValidateE ventArgs)

How do I contact the readRS function from here???

End Sub
--
Kristoffer Arfvidson - kr********@arfv idson.se

Tel: +46 (0)733 - 442 660
Please visit us: www.arfvidson.se

Dansportalen - Nordens STÖRSTA webb om dans!
www.dansportalen.se (Finns nu på tre språk)

Nov 18 '05 #2
Although you can't inherit the visual interface of a web page, your
codebehind class can be derived from another class. So:
1) Create a new web page to create the parent code-behind class, e.g.
WebPageAncestor . Ignore the .aspx user interface. Create all the "dbclass"
behaviour you need as methods of the WebPage Ancestor class in the
code-behind file.
2) For each new web page, make sure that the code behind class inherits from
WebPageAncestor instead of System.Web.UI.P age

HTH

"Kristoffer " <kr********@ant ispam.com> wrote in message
news:ef******** ******@tk2msftn gp13.phx.gbl...
Hi!
I have a general db class (a normal class, that contains the functions and
subs to enable me to connect to my database) ok...
but, HOW??

Do, I make use of this class in my asp.net application...
I need to contact it from my codebehind page...
but, I contact my codebehind page with the src= tag, so it compiles when I
contact the webpage, and not before...

the class is also a normal vb.net class, so its called dbclass.vb

How do I make use of this class from my codebehindpage?

eg...
member.ascx - Control, that shows the db info...
member.ascx.vb - Codebehindpage. ..
../classes/dbclass.vb - the dbclass that handles the db connection...

dbclass example function, that I need to be able to contact from the
chkuserEmail sub...
Public Function readRS(ByVal strQuery As String) As Object

End Function
the member.ascx.vb page contains a sub that for instance is going to check
the db for something:
'--Custom Validators--

Sub ChkuserEmail(so urce As object, args As ServerValidateE ventArgs)

How do I contact the readRS function from here???

End Sub
--
Kristoffer Arfvidson - kr********@arfv idson.se

Tel: +46 (0)733 - 442 660
Please visit us: www.arfvidson.se

Dansportalen - Nordens STÖRSTA webb om dans!
www.dansportalen.se (Finns nu på tre språk)

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1816
by: jason | last post by:
Hello everyone, I have some general questions about the DataTable object, and how it works. Moderately new to C#, I have plenty of texts describing the language, but not so much to reference ADO.NET objects (only the MSDN help files). I have written a C# Class Library that is responsible for encapsulating database information. All the objects work just fine for singleton record insert, update, select, and delete operations. But now we...
3
1259
by: needin4mation | last post by:
Just learning about interfaces and had a probably simple question. If a class inherits from an Interface, does this guarantee that the class will have the methods defined in the Interface? I know this is supposed to be true from what I read, but what I'm really asking is that if a class implements an interface and it does not somewhere in that class implement the methods, properties, etc. (all of them) in that class, will that cause the...
6
1922
by: S. Lorétan | last post by:
Hi guys. I am preparing the rewriting of an huge existing application in VB6. This software is a mess of 10 years of patchs and new functionalities added randomly, and didn't have any logical or oriented-object background. This software is used by many differents persons, and there is a LOT of functionalities that exists only for one or two of them. So, I want to use a plugin-based system. That's it for the background.
4
2014
by: Jon Slaughter | last post by:
I'm trying to wrap all the basic controls(Button, scrollbar, etc..) to allow for skinning. The problem is that many of the controls seem so different in the way they work. For example, right now I'm trying to wrap teh scrollbar class but when I override the OnPaint and OnPaintBackground prevent painting the scrollbar is still painted. How the heck am I suppose to know how to do these things if I can't find the information about how they...
0
10143
marktang
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...
0
11542
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11133
jinu1996
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...
1
11306
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,...
0
7395
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();...
0
6090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6312
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4914
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3517
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.