DataSource Controls :: Best Practice For SQL Connection?

Mar 11, 2010

I was just wondering what would be the best practice for sql connection in asp.net, when using a loop

[Code]....

or...

[Code]....

View 2 Replies


Similar Messages:

Good Practice - Connection String In Web.config?

Jun 30, 2010

Whats the difference, if in my web.config i use. both works with my code. what is right way of diong it? keeping connection string?

[code]...

View 4 Replies

DataSource Controls :: Connection Pooling And Check Connection State?

Apr 7, 2010

In my DAL i have more than 100 methods/Function, each and every method am opening the sqlconnection and closing the connection, this is taking too much of time to establish the connection at every time. So what i expect is one common class will create the SqlConnection that will check if the connection is Broken or Closed then create the connection again else return the connection, how to do this(Also i would like to apply ConnectionPooling).

View 7 Replies

DataSource Controls :: Variable Connection String Parameter In A DataSource Control

May 20, 2010

I have several web forms which use a GridView linked to a DataSource control which is defined at design time as follows:

<cc1:pgsqldatasource
id="dsStates"
runat="server"
connectionstring="<%&#36; ConnectionStrings:PgSqlConnection %>"
oldvaluesparameterformatstring="Original_{0}"
providername="<%&#36; ConnectionStrings:PgSqlConnection.ProviderName %>" >
</cc1:pgsqldatasource>

As you can see, the connectionstring parameter is defined to a specific connection string name and I need to be able to set such a parameter to a different value, for example, to a session variable content.

View 1 Replies

DataSource Controls :: How To Use Server.MapPath As Datasource While Creating Connection With OLEDB

Nov 15, 2010

i am trying to create connection using OLEDB connection in my app. but i am not able to create the connection as in datasource i want to use Server.mappath, but cudn't find the right method to use it. i am trying to make connection with Access database file. following is code i have tried:

string path = Server.MapPath("~/uploadaccess/Production.mdb");
string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("~/uploadaccess/Production.mdb")&";";
and also
OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path&";");
and tried this
OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("~/uploadaccess/Production.mdb"));

and this is the error i am getting:

Operator '&' cannot be applied to operands of type 'string' and 'string'

View 3 Replies

DataSource Controls :: Best Practice For Importing Files.xls Or Files.csv To Database?

Apr 16, 2010

I need to populate a database (SQL Server) with some data from a templated excel document.Here are some approaches:

A) User upload a file.xls or file.csv that the server reads, checks and updates the database (cons:the uploaded file might be too big. file.* needs to be in correct format)

B) User downloads a tool.exe to read and upload file.xls (cons: maintenance of the tool.exe)

C) Use of a web service in excel? (don't know how to do it) but
this article might give you a hint

Which one is the best to use? Are there any others?

View 4 Replies

DataSource Controls :: Ftp Connection Through Asp?

Feb 23, 2010

i have an asp page through which i want to access FTP server And retrieve data (only file properties )from there and get it in excel (or just display it on the browser)is there any way i can keep it simple and acess the data from the server ???

View 1 Replies

DataSource Controls :: Connection Errors

Mar 7, 2010

Connection Errors

[Code]....

View 5 Replies

DataSource Controls :: OLEDB Connection

May 27, 2010

The attached code, the oledb part, is giving me a blank web page saying it cant connect on my local dev server. I have another app with the same code, in fact I copied it and changed the db names. The one I copied from works fine.

[Code]....

View 5 Replies

DataSource Controls :: Passing Connection By Ref?

Mar 15, 2010

Issues with the below code. I feel something wrong here. Advisable to use or recode? below is my connection pooling class.

[Code]....

i create new connection and close the it by passing its reference as below in finally block.

[Code]....

View 7 Replies

DataSource Controls :: One Linq Query With Two Db Connection?

May 31, 2010

I want to use from two db connection in one linq query

My sample is:

int a=1;
if(a==1)
DataClasses1DataContext1 db = new DataClasses1DataContext1();
else
DataClasses1DataContext2 db = new DataClasses1DataContext2();
var q =
from c
in db.F_Groups
select c;

In this code a=1 so db connection is DataClasses1DataContext1

I want if a=2 then db connection = DataClasses1DataContext2

but this code is error.

db connections is completely same but in two deferent class a db connection is sql and another is oracle

View 4 Replies

DataSource Controls :: Could Not Establish A Connection To The Database

Apr 1, 2010

I'm having a problem, which I haven't had with other projects, in setting up membership. I have set up a aspnetdb database using the asp.net confirguration tool. The database is in the app data folder and I can set up users and roles etc from the web site administration tool. However, trying to log in within the application, using the login control I get "Login attempt was not successful".

I have noted the following :-

1. On the home page of the Web site administration tool the application:/ shows no application where as normally it would show the name of the application.

2. Clicking the AspNetSqlProvider test button, I get the error "could not establish a connection to the database"

3. Although various lines have been added to the web config file, no connection string has been created to the aspnetdb file in the app data folder.

4. If you right click on the aspnetdb file within the solution explorer, there is an option of "include in project". Selecting this doesn't however solve the problem.

View 2 Replies

DataSource Controls :: How To Programatically Set A Connection String

Sep 13, 2010

I am thinking of putting a drop down list to choose a couple of options. Depending on what is selected I want to then specify a specific connection string. I use the ConnectionString="<%$ ConnectionStrings:SomeConnectionString %>" format. How can I handle this in the .aspx page?

View 4 Replies

DataSource Controls :: SQLDataSource Connection String On The Fly?

Sep 12, 2010

I need to set the SQLDataSource connection string on the fly. Right now, this is what I have:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
OnSelecting="SqlDataSource1_Selecting"
SelectCommand= (working select stmt here)</asp:SqlDataSource>

Then, I have this:

[code]....

View 4 Replies

DataSource Controls :: ReadOnly DB Connection Strings

Jan 14, 2010

This seems like a really silly question, but I've had a search around and I can't find anything about this. I've got a DB connection string that I'm creating in my web.config:-

[Code]....

and

[Code]....

but I need this connection to be read only. I've defined all my linq objects with only gets on their properties, and none of my (MVC) repository classes have .SubmitChanges() methods in them so I'm 99% sure the system can't update this DB, but I would also like to set my DB connection to be RO if at all possible. I realise that ideally this should be done at the SQL server end and the user should be made RO, but that (for various reasons, out of my control) can't be done, so I wanted to lock down my connection as the app mustn't write to the DB.

Is there a "readonly" parameter I can apply to the connection string so that it would throw an error or discard the data if any updates were attempted?

View 8 Replies

DataSource Controls :: Inner Join Using Two Different Connection Strings

Feb 11, 2010

Anyone know if it's possible to inner join tables using two different connection strings? I'm using vb.

View 3 Replies

DataSource Controls :: CLR Connection String From Web.config?

Jun 16, 2010

I am using CLR project in my website.I have used bulk insert in there.I am not able to use context connection in the procedure.Is there any way to get the connection string from web.configor from context connection.

View 5 Replies

DataSource Controls :: Get The Connection String Of Sql - Don't Have Sql Management

May 15, 2010

i work with sql database i want to connect to sql server i dont have sql manegment who could i c the connection string the palce of the sql that wen i write these comand sqlconnection con = new sqlconnection("the connection string")

View 4 Replies

DataSource Controls :: Better Way To Retrieve Connection String?

Apr 7, 2010

I have an app that connects to only one db for all of the data that the app has access to. My connection string is in the Web.Config file. In each of my DAL classes I have the following code that gets the connection string from the Config file. This works with no issues but I thought there might be a better way of doing this that I don't know.

If I wanted to change the name of the connection string that any of the DAL classes would use then I would have to change the name of the connection string in each of the files. I thought about creating a new class that would hold this then I could just instantiate a new instance of the class to access this with each of the DAL classes that needs access to it. Then if I needed to change the name of the connection string then it would only be in one place. I suspect there is an even better way of doing this that i don't know about.

[Code]....

View 3 Replies

DataSource Controls :: Open / Close Connection To DB?

May 4, 2010

When I'm using this to open Connection to DB,

Do I need to Close it at the end?

Or by using it, it close by itself?

using (SqlConnection cnn = new SqlConnection(connectionInfo))

View 2 Replies

DataSource Controls :: Connection Leak In IDataReader?

May 26, 2010

I heard that using "Using" Block avoids Connection Leaks in IDataReader. Is this correct??? If so how it will do that???

View 2 Replies

DataSource Controls :: Declaring New Sql Connection Failed?

Jan 13, 2010

I got a simple SQL Connection which works fine under VS 2005, once I convert to VS 2008, is failed to work. I even re-build entire apps from scratch under VS 2008, yet it still failed.

Here's the code.

[Code]....

The code failed at this line:

objCon = New SqlConnection()

Error message being:

The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception.

View 4 Replies

DataSource Controls :: Vb.net Database Connection - Try/catch Or Using?

Jun 11, 2010

I'm trying to weigh up which is the better most reliable database connection for use on a vb.net/ms sql site. I've previously experienced problems catching and closing db connections with the using statement if an error occurs, but do like the fact it doesn't need to use any global variables. Both examples use a general Database class file which opens and closes a connection.my current examples are: TRY CATCH EXAMPLE:

[Code]....

[Code]....

View 1 Replies

DataSource Controls :: How To Retrieve The USERID That Is Being Used To Make Connection

Mar 18, 2010

If I m using Windows Auth in my connectionstring i.e Integrated Security = SSPI / Trusted_Connection = Yes,

Is there any way to retrieve the USERID that is being used to make connection?

View 3 Replies

DataSource Controls :: Connection Strings Errors On Compile

Jun 8, 2010

I have a drop down with different domains(domain_id column) and a textbox (TextBoxComment) for comments. What I am trying to do is select the area, input a comment, click the button and have it save to the db. My connection string errors on compile.

[Code]....

View 8 Replies







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