Architecture :: Creating A Separated Class For Database Connection?

Dec 10, 2010

i have the following code:

[Code]....

I was trying to implement as above. How can i call this class from the code behind of my page, and call the methods Open and Close connection ?

How do i instantiate the object ?

View 5 Replies


Similar Messages:

Architecture :: Creating A DB Connection In My DAL Class File?

Feb 17, 2010

Below is my class file.

[Code]....

View 1 Replies

Architecture :: Creating Each Class Library Project For Interface?

Jan 11, 2010

weather to create each class libaray project for Interface, Service, Model, DTO, Repository ?

View 1 Replies

Architecture :: Creating A Simple Backend Without A Database?

Feb 11, 2010

I want to start creating sites with simple backends! I don't know much about databases though and I don't want to jump straight into creating sites with databases anyway. So I want to find out what the best way of creating a simple backend without using a database is.

I have an asp.net webpage which is a prices page detailing the prices of services at a hair salon. The prices change every 6 months so I want to give the client a simple backend so he can update the prices himself. The backend will just be a table of inputs populated with the current prices which can be changed and then click 'save changes' to update the site.

Now what is the best way of implementing this?

A) In the prices page, hard code an html table, within each cell code a <span> tag with an id for the price that will go within the span tag like id="menscut" and within the span tag hard code the price of the service. Then wirte a C# class called 'edit' that is used when the 'save changes' button is clicked on the backend page. When 'save changes' is clicked the 'edit' class parses the prices.aspx page and finds <span id="menscut">£20</span> and then changes it to <span id="menscut">£22</span> (or what ever new price has been entered in the backend) and then saves the new edited prices.aspx page over the old one on the server.

or

B) Don't hard code prices into the prices.aspx but instead store the prices in a seperate .txt or .xml file. Every time the prices.aspx page loads it runs a class called 'populate' which extracts the prices from the .txt file or .xml file and inserts them into the table in the prices.aspx page. And now the edit class instead of editing the prices.aspx page it edits the .txt or .xml file.

So which of those ways is better, or if they are fairly even pegged what are the pros and cons of each?

Or are there any other options I haven't thought of?

View 3 Replies

Dynamically Creating Database Connection In Datasets?

May 4, 2010

I am currently using datasets for my data access layer. I currently store the connection string in the web.config file. I need the ability to change the connection to another database before any queries are processed. Is there an event that is triggered or a base class that can be modified that intercepts the process of retrieving the connection string from the web.config file? Is there any way to handle multiple database connections using the same code base and also take advantage of the connection pooling? I understand the best method is to get rid of datasets and use custom data objects.

View 2 Replies

C# - How To Overload Database Connection Class

Mar 9, 2011

I use the class below in my code-behind to connect to my database. How would I (overload?) this class to choose between multiple connection strings (databases)?

Or should I have a separate class for each connection?

[code]....

View 5 Replies

How To Make Database Connection Class

Jan 19, 2011

how make the class for database activities and it can be used in code behind

coz i want avoid the connection opening, closing activities, insert,update etc methods in code behind frequently.

the class should include connection open and closing method, passing values to stored procedures etc.

How should we construct it?

View 8 Replies

SQL Server :: Error In Attaching Database File And Creating A New Connection?

Sep 5, 2010

I am having problem when i was trying to attach .mdf file while create a new connection of SQL server, create a new connection of SQL database file and open the database in Server Explorer. I am using VS 2010 Ultimate and SQL Express 2008 R2.

Here are the error message.

1. Attach .mdf in SQL database file and open the database in Server Explorer

2. Create a new SQL server and attach .mdf

View 5 Replies

Database - Storing Connection In A Static Class?

Mar 4, 2010

Since I'm using Postgresql and can't use LINQ to SQL, I wrote my own wrapper classes.

This is a part of the Student class:

[code]....

It works now! I replaces all Run methods in the Student class with DB.Run

But I want to know if it will work fine with a lot of people online, not me only. I'm not sure how static things work with ASP.NET, maybe it'll eat a lot of memory?..

View 3 Replies

ADO.NET :: Create Class Files When Connection To SQL Database?

Mar 14, 2011

I am new to Visual Studio 2010 and ASP.Net, and when I first connected my SQL Server to Visual Studio it created huge files full of my SQL classes (maybe this was LINQ classes), and I accidently deleted/corrupted those files, and now I want it to create those classes again. Can someone tell me how I can do that?

View 5 Replies

Architecture :: Accessing A Different Class Depending On The Database Type?

Mar 25, 2010

I need to make a webservice in .net (I know how this works) but then I need to get data out of a database. But my company wants to make it in a way that you can use the system with multiple databases.

So my option was make multiple abstract classes which contains the folowing code (depending on the database type, this would be a SQL database)

public abstract class AbstractDAO<T, Tid>

View 5 Replies

Put The Database Connection Settings Into A Base Page Class?

Mar 16, 2010

it's possible to put the database connection settings into a base page class so that I can auto-init them on a page. like this document: [URL] but with instructions in VB.net

View 1 Replies

Creating Objects From C# Class To Use Them In Database Functions?

Nov 25, 2010

I have created class in C# i need to use objects from this class to add them to a databse table.

the information come from textbox go into the object of the class than from this object i want to preform databse function.

View 2 Replies

Creating An Abstract Class That Will Define All Database Manipulation Methods To Implement

Mar 3, 2010

I am developing a couple of small ASP.NET application and would like to know what pattern. approach do you use in your projects.

My projects involve databases, using Data access and Business logic layers.

The data-access approach that I was using so far is the following(I read in some book and liked it):

For DAL layer:

Creating an abstract class that will define all database manipulation methods to implement.
The abstract class will contain a static "Instance" property, that will load (if instance == null) an instance (Activator.CreateInstance) of the needed type (a class that implements it).

Creating a classes that implement this abstract class, the implementation will be according to the databases (SQL, mySQL and etc) in use.

With this I can create different implementation according to database in use.

For BLL layer:

A class that encapsulates all all retrieved fields , and static methods that will call the DAL classes.

View 3 Replies

Making Ado.net Connection Class Or Connection String In Web.config?

Oct 18, 2010

I am preparing for an Access2007 db conversion at the beginning of the year and would like to know what the best process would be for connecting to the sqlserver2005 database. I have read about adding the connection string to the web.config file. I have also read about using ADO.NET and put the connection information into a class and not the web.config file.

I would like to hear from others as to what you have used, are using, or plan on using for a webapp (vs2010), and why so I can get an understanding.

View 3 Replies

Data Controls :: Bind Pipe Separated String As Columns And Comma Separated Strings As Rows In Repeater Control

Feb 1, 2013

I am redirecting string like this a1|b1, a2|b2,a3|b3.... to another page.

On next page I have repeater control

And I want to show data in repeater control like this

  a1  b1

  a2  b2

  a3  b3.

How can I show value like it in repeater control?

View 1 Replies

Forms Data Controls :: ListView Connection Error - Database Schema Could Not Be Retrieved For This Connection?

Jul 23, 2010

I am using VS2008 and oracle 10g ODP.Net. The oracle database that I used in the connection is working and tested it using sql plus.The connection string when used in a GriDView works perfectly. Now when I created a new listview control with the same connection it gives an error.Database schema could not be retrieved for this connection. Please make sure connection settings are correct and the database is online

Object reference not set to an instance of an object at VSDataObjectSupport (478,6)

View 2 Replies

Retrieve Record In Comma Separated String From Multiple Database Column?

Dec 30, 2010

i have textbox1 and textbox2 and 8 checkboxes in my ASP.NET (VB.NET) webform. i want to retrieve the seats on the particular dates means if i enter 11/12/2010 in textbox1 then in textbox2 the output would be from seat_select column, let say (1,2,3) where date would be 11/12/2010 If i enter 13/12/2010 in textbox1 then in textbox2 the output would be 1,2

View 3 Replies

How To Retrieve The Two Database Column Values To Textbox As Comma Separated String

Dec 30, 2010

If i have two textboxes textbox1 & textbox2 and button1 in my ASP.NET and SQL Server database

Database records are:

ID Date Seats
1 15-Dec-2010 1,2
2 15-Dec-2010 3,4
3 17-Dec-2010 1,2,3,4

I want when i type 15-Dec-2010 in TextBox1 and Click on Button1 then in textbox2 The Output would be retrieve from Database using SELECT query then in TextBox2 the output would be displayed as 1,2,3,4

That the exact i want using SELECT query and VB.NET.

View 3 Replies

Data Controls :: Bind Comma Separated String From Database To GridView

May 7, 2015

I have a string in datbase like 10,11,12,13,14,15.

I want to bind in GridView as 

10

11

12

13

14

15

View 1 Replies

Data Controls :: Save Files In Folder While Their Name Comma Separated In Database?

Feb 2, 2014

I have a fileupload control in my web page, through which multiples files are uploaded one by one.And those multiple uploaded files are shown in 'Gridview' below the Fileupload control with Download and Delete button.Now, I want to save all the uploaded files coming in Gridview in my Database column (named "FileName") Separated by comma for particular column ID.i.e, If Gridview contains 3 uploaded files: abc.docx, xyz.pdf, aaa.txt then all the 3 files should also save in database column (named "FileName") for a particular ID.DB table is:

ID Address FileName
1 Aa Abc.txt, xyz.docx
2 Bb
3 Cc
4 dd

How to achieve this?

View 1 Replies

Architecture :: Remote Desktop Connection?

Dec 6, 2010

Is it possible to connect to a Remote Desktop from my ASP.net (I easily done it in .net windows application with a 4 line code and"Windows Terminal Service Control")application, If so can you guide me through it. Many thanks in advance.NB:I want to achieve it without using ActiveX control that work in IE, because with that every client would have to use IE and install the control.

View 6 Replies

Data Controls :: Insert DropDownList Selected Values As Comma Separated To Database?

Sep 20, 2015

I have days valus in asp.net page ,

How to get values from aspx page to .cs and how to insert sql server .

(Ex:  Monday,Sunday,....)

View 1 Replies

Data Controls :: Join A List Of String As Comma Separated Characters And Save In Database?

May 7, 2015

i want to save id of all products, selected for user in a session variable 

Session["Cart"]
 
after in another aspx file called basket.aspx, want get all items from session variable and bind DataGrid called List.

View 1 Replies

Data Controls :: Splitting Comma Separated Values In Database And Assign To Multiple Textboxes

Apr 27, 2016

I have 5 textboxes in my webpage for entering address, i.e,

door no, village, city, district, pincode.

These are concatenated by comma (,) and stored into the database field address. at the time of retrieving, the concatenated address, should be separated and assign to each textboxes.

View 1 Replies







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