|
hi all,
I have created an Application level connection string variable in my Global.asax
Like:
Application("glbConnection") = con.getDBConnection()
I accessed that variable in My Business class like,
con As IDbConnection = Application("glbConnection")
But i Got the Error as ,
System.NullReferenceException
{"Object reference not set to an instance of an object."}
Message : "Object reference not set to an instance of an object."
I need to access my application variable in my Class file.
can anyone help me out to solve this problem
Thanks in advance.
Regards
senthilraj K
|
|
|
|
|
|
To solve your current problem : I guess con.getDBConnection() returns a null value
To solve your next problem, I don't think you want to connect to your database throughout your website this way.
You say you have a business class. The business class should be in a separate project (your business project) which contains all db functionality and stuff and returns the required information to your user interface (in this case a website). In theory, you're website shouldn't be able to 'know' your connection string.
|
|
|
|
|
i am getting the connection string in my code behind file when i use the appliaction variable (webform1.aspx.vb)
When i try this with my class i am getting the error.
Do i need to import any namespace in my class file to access this application variable in my class??
thanks,
Senthilraj K
|
|
|
|
|
|
hi navaneeth,
i tried with your option.but, when i try to type the Context.Application i am getting the error as 'Context' is not accessible.
I have imported the 'System.Web.HttpContext' in my class.but still getting the error....
do you have any sample code to do this????
thanks,
Senthilraj K
|
|
|
|
|
Erhm, in this case, you can better create a function which connects to the database for you in your businessfile
public void ConnectDb(object ConnectionString)<br />
{<br />
if (ConnectionString == null)<br />
return;<br />
<br />
con = new con(ConnectionString.ToString());<br />
<br />
}<br />
and call that function from your webpage
ConnectDb(Application["yourvariable"]);
|
|
|
|
|
For security reasons you should define your connection strings in web.Config, and access then using the ConfigurationManager.ConnectionStrings[^] properties
Cheers,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
But using web.config for only a connectionstring isn't really the neat way, because handling a web.config is relatively pretty time consuming...
|
|
|
|
|
Hi friends,
I have one query, in my project i will show the details about particular product when hover the mouse the relavent product image. All the details come from DB so it will do only in Ajax. so anybody have sample code for that one? If anybody please give nad help me. Thanks in advance....
Praveen Kumar.R
|
|
|
|
|
Do you mean using AJAX in ASP.NET, or using the ASP.NET AJAX framework ? How many images are there, that you need to make an AJAX call ?
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 )
|
|
|
|
|
I mean using AJAX in ASP.NET. Nearly 10 images are there.
Do u have any sample code?
Praveen Kumar.R
|
|
|
|
|
Microsoft JET Database Engine error '80040e10'
No value given for one or more required parameters.
on code above i get an error like that but not often, why?
Socheat
|
|
|
|
|
Because you failed to provide a value for one or more parameters ? This is the ASP.NET forum, classic ASP belongs in the web dev forum.
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 )
|
|
|
|
|
I have a requirement in my web application where in I have to display an image on ASP button. I cannot use an image button. Is it possible to diaplay an image on asp button?
------------------------------
If u think u can, u can.
If u think u can't, u r right.
|
|
|
|
|
hi,
you can use image tag and give the option to handle the clicked event.
That will help u.
All The Best
Sathesh Pandian
|
|
|
|
|
Thanks for the reply sathesh. But in my application, we have customized buttons. We must use those buttons. any alternative?
------------------------------
If u think u can, u can.
If u think u can't, u r right.
|
|
|
|
|
mareers wrote: But in my application, we have customized buttons. We must use those buttons
Then what is the use of asking question without placing sample code of that customized button.
|
|
|
|
|
Let me get this. Your asking us how to use some custom controls we don't have access to, and we cannot see the code for?!
That's smart.
Stop for a moment and think about it.
Cheers,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
Hi,
Please help with the following:
I have an application where I have single searcher and advanced searcher on a same page. one textbox and a button at the top of the page, 4 textboxes and a button at the bottom. I have two required field validator with different validationGroup(Single||Advanced). This works fine with single but on advanced searcher it it is another story since ControlToValidate property of required field validator only accept one field. How can I solve this?
|
|
|
|
|
i want to know about .net remoting and .net webservicing in a simple way.
1. what are they and how to use in asp.net
2. how to create webservicing?
3. what is advantage over .net remoting?
4.what i have write in server and client side?
5. can i use this method if some of my clients stores data in mysql for the part of application and rest in oracle. change in data of some tables in mysql will effect the change in corresponding master table in oracle and visa versa?
can anybody say me the good website available regarding the articles of .net remoting and .webservice.
vijaya
|
|
|
|
|
Why don't you have a search on google and come back with specific questions rather than asking the entire concept ?
|
|
|
|
|
Do not cross-post! You have been here long enough to have read the forum rules.
Second, your hand does not seem broken since you typed your message okay. How about using this new fancy-shmancy thing called Google?
______________________
stuff + cats = awesome
|
|
|
|
|
Hi in my datagrid i am binding the dates in one bound column...,
Its display like mm/dd/yyyy 12:00:00 AM........,(7/1/2007 12:00:00 AM)
But i like to show only mm/dd/yyyy only...,(7/1/2007)
How to display like that...,
Regards,
Magi
|
|
|
|
|
assuming your are using sql server 2000 as database,
in your select query write: convert(varchar, date_column_name, 101)
this is one way!
Gautham
|
|
|
|