Click here to Skip to main content
15,901,035 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionDatabase Connectivity !! Pin
shweta@syscom3-Aug-07 20:23
shweta@syscom3-Aug-07 20:23 
AnswerRe: Database Connectivity !! Pin
Christian Graus3-Aug-07 21:20
protectorChristian Graus3-Aug-07 21:20 
AnswerRe: Database Connectivity !! [modified] Pin
manowj3-Aug-07 21:21
manowj3-Aug-07 21:21 
GeneralRe: Database Connectivity !! Pin
Christian Graus3-Aug-07 21:30
protectorChristian Graus3-Aug-07 21:30 
AnswerRe: Database Connectivity !! [modified] Pin
sulabh20203-Aug-07 21:52
sulabh20203-Aug-07 21:52 
GeneralRe: Database Connectivity !! Pin
Christian Graus3-Aug-07 22:01
protectorChristian Graus3-Aug-07 22:01 
GeneralRe: Database Connectivity !! Pin
sulabh20203-Aug-07 22:07
sulabh20203-Aug-07 22:07 
GeneralRe: Database Connectivity !! Pin
Christian Graus3-Aug-07 22:22
protectorChristian Graus3-Aug-07 22:22 
OK, so long as you're asking

public SqlConnection con = new SqlConnection();
string connect= "Server=Server_path;Database=ABC;User=userassword=Password";

con = new SqlConnection(connect);

I assume that public means that con is a member variable. Otherwise, it's an error.

You create a new object at the point of declaring the variable.

You assign a string to the connection string, although you don't expose it in any way ( which is not wise )

Then you use this string to create a new connection object ( your second ), meaning that the first one is never used, and if this is a member variable, as it seems to be, it means that you have a member object, but you recreate it, every time you use it.


Christian Graus - Microsoft MVP - C++

"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

GeneralRe: Database Connectivity !! Pin
sulabh20203-Aug-07 22:37
sulabh20203-Aug-07 22:37 
GeneralRe: Database Connectivity !! Pin
Christian Graus3-Aug-07 22:47
protectorChristian Graus3-Aug-07 22:47 
GeneralRe: Database Connectivity !! Pin
N a v a n e e t h3-Aug-07 22:36
N a v a n e e t h3-Aug-07 22:36 
Questionset length for value Pin
praveenkumar_mca3-Aug-07 19:57
praveenkumar_mca3-Aug-07 19:57 
AnswerRe: set length for value Pin
Christian Graus3-Aug-07 21:19
protectorChristian Graus3-Aug-07 21:19 
AnswerRe: set length for value Pin
manowj3-Aug-07 21:24
manowj3-Aug-07 21:24 
QuestionTime fromat Pin
praveenkumar_mca3-Aug-07 19:16
praveenkumar_mca3-Aug-07 19:16 
AnswerRe: Time fromat Pin
Christian Graus3-Aug-07 21:18
protectorChristian Graus3-Aug-07 21:18 
QuestionExporting grid data to Excel Pin
Rahithi3-Aug-07 19:01
Rahithi3-Aug-07 19:01 
AnswerRe: Exporting grid data to Excel Pin
praveenkumar_mca3-Aug-07 19:27
praveenkumar_mca3-Aug-07 19:27 
AnswerRe: Exporting grid data to Excel Pin
manowj3-Aug-07 21:26
manowj3-Aug-07 21:26 
AnswerRe: Exporting grid data to Excel Pin
Rahithi4-Aug-07 4:07
Rahithi4-Aug-07 4:07 
Questionwhy Session_End is fired? Pin
Nicejith3-Aug-07 18:44
Nicejith3-Aug-07 18:44 
AnswerRe: why Session_End is fired? Pin
manowj3-Aug-07 21:29
manowj3-Aug-07 21:29 
Questionfile uploading (error: Illegal characters in path) Urgent! Pin
Milind Panchal3-Aug-07 18:14
Milind Panchal3-Aug-07 18:14 
AnswerRe: file uploading (error: Illegal characters in path) Urgent! Pin
Edwin Syarief3-Aug-07 18:48
Edwin Syarief3-Aug-07 18:48 
QuestionFree refactoring tool for ASP.Net Pin
cycnus3-Aug-07 16:38
cycnus3-Aug-07 16:38 

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.