|
Hi shweta, well what i guess abou you is , u r new to this field.
may i ask u that r u working for noida branch.
well this is ur ans for connectivity.
string connect= "Server=Server_path;Database=ABC;User=user;Password=Password";
SqlConnection con = new SqlConnection(connect);
try it and make me know.
Hello Forum
Always be in touch to help about the topic ASP.NET
|
|
|
|
|
Why is your connection string not in resources ? Why do you create two connection objects in this code ?
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 )
|
|
|
|
|
plz look the code properly than question.
I have taken one connection object
and another a simple strin to pass on this object as credentials of server where to connected to.
Hello Forum
Always be in touch to help about the topic ASP.NET
|
|
|
|
|
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 )
|
|
|
|
|
Also we can use our common sense while declaring the variables.
What i ans for the connectin doesnt mean that this is the exact and only ans for this post, its a Hint of doing.
And one who needs toimplement this can use its little mind according to its need.
For ur graet information i always use this as staic and defined under one class, so every time u have to declare the connection string.
Hello Forum
Always be in touch to help about the topic ASP.NET
|
|
|
|
|
sulabh2020 wrote: What i ans for the connectin doesnt mean that this is the exact and only ans for this post, its a Hint of doing.
OK, well, I pointed out some bad practises in your code, you rejected the claim. It seems that you accept it now ?
sulabh2020 wrote: so every time u have to declare the connection string.
It is always better to expose your connection string in a config file.
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 )
|
|
|
|
|
sulabh2020 wrote: public SqlConnection con = new SqlConnection();
string connect= "Server=Server_path;Database=ABC;User=userassword=Password";
con = new SqlConnection(connect);
Looks bad design for me. con = new SqlConnection(connect); is not needed, using this line you are creating one more object for the SQLConnection class. SQlConnection object have a property ConnectionString . Instead of creating new connectiion assign value to this property. Or write connection initialization code after creating connectionstring.
|
|
|
|
|
Hi guys i have a value for example 23 now i display this like "000023.0" length shoulbe be 8. if i give 44.5 means it should display "000044.5", so lenght not exeed 8. please tell me how to display like this.
Praveen Kumar.R
|
|
|
|
|
Same as below - the Format method on the string class, or even the ToString on the int class, can be told what number format is needed.
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 )
|
|
|
|
|
Hi,
Try this
Format(<VariableName>,"000000.00") will give the result.
Regards,
Manowj
|
|
|
|
|
Hi guys i want displat the time like this format "06:12:12000000008" please let me know anybody know. how to write code
Praveen Kumar.R
|
|
|
|
|
Use the string's Format method to build the number in the format you need.
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 )
|
|
|
|
|
hi,
i am trying to export the data from ASP.NEt datagrid to Xls file.
i am recieving this error :
Control 'dgBillsReviewed__ctl2__ctl0' of type 'DataGridLinkButton' must be placed inside a form tag with runat=server.
i am using HTMLtext writer to export the data. i am taking template columns in my grid. if i remove these template columns(when i drctly set the datasource, it is working fine)
please let me know the solution...
Thanks,
Rahi
If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
HI Rahi in ur HTML there is no Form tage so please put form tag and try again may be it will work if ur coding is correct.
Praveen Kumar.R
|
|
|
|
|
Hi,
Confirm that the datagrid is placed in between the <form> and </form>.
Regards,
Manowj
|
|
|
|
|
hi,
thanks for responding to my query.
my grid is placed in the Form Tag. still it is giving this error.
i am using Item Template to bind the data ...and i am using lables to display the grid data.
how to resolve this?? any idea??
Thanks,
Rahi
If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
why Session_End is fired after i deleted a folder using directory.delete(folderpath,true)
|
|
|
|
|
Hi,
This can be any one of the reasons.
(1). Given Session time might be expired.
(2). Time out because of slower response time
(3). Session got destroyed in any part of your code.
Check these.
Regards,
Manowj
|
|
|
|
|
Hi,
I am uploading multiple files from my web application. It is working fine on local pc. But when I am trying to upload file on server it gives erroe as "Illegal characters in path".
Can any one give me solution for this ??
Thanks!
|
|
|
|
|
Maybe U should use this
string path = Server.MapPath(@"~\Your_folder");
"@" means to escape backslash into string. And "~\" means that your files will upload into server folder.
Regard,
Edwin
|
|
|
|
|
if you're using Visual Studio to develop your ASP.Net applications, you may want to have a look at the extremely cool refactoring tools for ASP.Net just made available for free by Developer Express.
Have a look at see this blog entry and don't miss the link to the screencast!
More info can be seen (lots of screenshots) on this page from Mark Miller, the funny brains behind these productivity tools.
|
|
|
|
|
Woah, Thanx Cycnus, how do know about this coolest tool?
This is great!!!
Regard,
Edwin
|
|
|
|
|
I use the components and other tools developed by this company.
The non-ASP tools have lots more features but are not free. They are really cool an useful though and I couldn't do without them.
I love the visual effects too...
|
|
|
|
|
thanks for the infomation
Regards,
Tomi
|
|
|
|
|
Here is what I am trying to do. I am using ASP.NET 2.0. I have created a data set called Stocks data table called Data and put it in the App_Code folder. I am filling the data table from data in a csv file located on the web. I am populating the data table with the following code. This code works because I checked the record count and it shows 21 records for the Data data table.
public static DataSet Convert()
{
WebClient Client = new WebClient();
Stream myStream = Client.OpenRead("http://mysite.com/table.csv");
StreamReader myStreamReader = new StreamReader(myStream);
Stocks myStocks = new Stocks();
string line = myStreamReader.ReadLine();
string allData = myStreamReader.ReadToEnd();
string[] rows = allData.Split("\r\n".ToCharArray());
foreach (string r in rows)
{
string[] items = r.Split(",".ToCharArray());
myStocks.Tables["Data"].Rows.Add(items);
}
return myStocks;
}
I am trying to bind the data in this table to a report. I added a report to my project and selected the fields from the data table. I then added a ReportViewer control to the web form. I’m not sure how to configure the ObjectDataSource that is added to the web form after the ReportViewer control is added. It firsts asks to select business object. I have the following options. I’m not sure what to select.
Stocks
Stocks + DataTable
Stocks + DataRow
Stocks + DataRowChangeEvent
Stocks + DataRowChangeEventHandler
Next I need to define a data method. Not sure what option to select. I just want to bind the report to the data table and return the rows.
Any help would be appreciated. Thanks.
Weste
|
|
|
|