|
hi
i didn't get your ans ... I just simply ask
difference bet if ( someVarial == null) and if (null == somevariable)
i.e position of nulll should be first or not I know both expression are evaluating same result.but if u see some code they comaore like
if (null == someVarible) i.e position of null is first why ??????
Here someVarible is an refrence type not a value type ......
YOgesh M
|
|
|
|
|
yogsworld wrote: position of null is first why ??????
I explained why. It is a historical thing. Developers who programmed in languages such as C or C++ put null first as a way of protecting themselves by having the compiler flag an error to them. The error being the accidental missing equals sign.
= means assignment
== means a comparison
These two concepts produce radically different results, yet are very very easy to accidentally mix up. Someone typing fast may miss one of the equals signs.
In C# the compiler demands that the result of the conditional expression in an if statement evaluates to a Boolean value. I demonstrated the various error messages that the C# compiler would generate that a C or C++ compiler would not likely generate.
I should clarify: Putting the null first is not completely the same as putting it second IF there is an error in the code. If the code is written correctly with the double-equals (comparison) operator then the code is the same.
Does this make sense?
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
We have a system that uses Asp.net and Sql with c# as the back end, when we run the system it catches most of the RAM space,
why is this happening?
whats the solution for this problem
waiting for an reply ASAP
with regards,
KarthiBalu
|
|
|
|
|
karthiBalu wrote: when we run the system it catches most of the RAM
Because the memory manage sees that it can. If something else needs the memory then the memory manage will kick off a garbage collection and recover the memory.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Im new in SQL, im trying to connect to sql data base but it give me exception-->(Login failed for user ''. The user is not associated with a trusted SQL Server connection.)
i think there is wrong with SqlConnection parameter, so what is the wrong?
im with sql express 2005 & vs2005
SqlConnection SQLConn;
SQLConn = new SqlConnection( " Data Source = .\\SQLEXPRESS;" + "
Initial Catalog = MTDB; " );
SQLConn.Open();
|
|
|
|
|
you did not mentioned uid and pwd.
or ty OLDDBConneciton object.
raj
|
|
|
|
|
im using Windows Authentication so what is my user id and password will be ?
|
|
|
|
|
If you are using Windows Authentication then you do not pass a user name and password.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Does the user your process is running as (ASPNET probably) have permission to log on to the database. By default the answer is no. You must add a login to SQL Server to accept the user you are connecting as. You must also add that user to the database on the server you want to connect to.
You have not specified a user in your connection string so I'm guessing that it will just default to trying to use a trusted connection (the error message hints at this also). ASP.NET applications connect using a special locked down account (for security). That account is generally ASPNET, although on some operating systems it will use another account (Win Srv 2003 will use NT AUTHORITY\NETWORK SERVICE)
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
im using Authentication: Windows Authentication, so i did not entered username or password , for this reasone i did not specified a user in my conection string, i dont know if i have to put a user , if yes i have to then what is my user will be ?
thanks
|
|
|
|
|
You might find this article useful: How To: Connect to SQL Server Using Windows Authentication in ASP.NET 2.0[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
the connection string should include "Integrated Security=SSPI".
that is
SQLConn = new SqlConnection( " Data Source = .\\SQLEXPRESS;" + " <br />
Initial Catalog = MTDB; Integrated Security=SSPI " );
hope this will help you.
Cheers
Ramesh.Kanjinghat
|
|
|
|
|
but your answer too late , i already did it, any way thanks
|
|
|
|
|
hi all,
ok so I have a formview thats bound to an objectsource.
within the formview, I have a listbox that I added myself.
<asp:listbox id="ListBoxObjective" runat="Server">
<asp:listitem>Item 1
<asp:listitem>Item 2
<asp:listitem>Item 3
how do I set the right value selected within this lisbox? all other
values on textboxes is being set with
Text='<%# Bind("objective") %>
but it wont allow me to put this binding on listitems.
any ideas?
thx
M
|
|
|
|
|
Hi there,
You can bind the value to the SelectedValue property of the ListBox control instead of the Text property of the ListItem.
|
|
|
|
|
Hi
I’m new to ASP and I have a problem Passing parameter to a report. I tried to pass an integer parameter to a crystal Report on a web from. So I wrote the following code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim ParameterFields As CrystalDecisions.Shared.ParameterFields
Dim ParameterField As CrystalDecisions.Shared.ParameterField
Dim ParameterValue As CrystalDecisions.Shared.ParameterDiscreteValue
Dim DepID As Integer
DepID = 8
ParameterFields = New CrystalDecisions.Shared.ParameterFields
ParameterField = New CrystalDecisions.Shared.ParameterField
ParameterField.ParameterFieldName = "@DepID"
PArameterValue = New CrystalDecisions.Shared.ParameterDiscreteValue
ParameterValue.Value = DepID.ToString
ParameterField.CurrentValues.Add(ParameterValue)
ParameterFields.Add(ParameterField)
CrystalReportViewer1.ParameterFieldInfo = ParameterFields
Dim MyRep As New CrystalReport1
CrystalReportViewer1.ReportSource = MyRep
CrystalReportViewer1.RefreshReport()
End Sub
But It did not worked and I receive the following error:
Missing parameter field current value.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: CrystalDecisions.CrystalReports.Engine.ParameterFieldCurrentValueException: Missing parameter field current value.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ParameterFieldCurrentValueException: Missing parameter field current value.]
. F(String , EngineExceptionErrorID
) +574
CrystalDecisions.CrystalReports.Engine.FormatEngine.internalSetReportInfo(RequestContext reqContext) +1293
CrystalDecisions.CrystalReports.Engine.FormatEngine.internalGetViewContext(ReportPageRequestContext reqContext, * viewContext) +217
CrystalDecisions.CrystalReports.Engine.FormatEngine.GetPage(PageRequestContext reqContext) +280
CrystalDecisions.ReportSource.LocalReportSourceBase.GetPage(PageRequestContext pageReqContext) +189
CrystalDecisions.Web.ReportAgent.u(Boolean N) +164
CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e) +108
System.Web.UI.Control.PreRenderRecursiveInternal() +62
System.Web.UI.Control.PreRenderRecursiveInternal() +125
System.Web.UI.Control.PreRenderRecursiveInternal() +125
System.Web.UI.Page.ProcessRequestMain() +1489
Can anyone help me??
Thanks in advance
AVA
|
|
|
|
|
Hi all,
I have a problem with WebService & WSE 3.0
When I create a web service and create a application to use my web service.
Afterward I use WSE Setting Tool to secure both my web service and application with Certificate mode (mutualCertificate11Security).
But when I start my application to call a service, this error appear:
The ex.Message as follow:
"WSE910: An error happened during the processing of a response message, and you can find the error in the inner exception. You can also find the response message in the Response property".
The Response.Fault as follow:
"System.Web.Services.Protocols.SoapHeaderException: SOAP header Security was not understood."
The InnerException as follow:
"Security requirements are not satisfied because the security header is not present in the incoming message."
Please help me solve this problem,
Thank you for you help!
Hung.
Hung
|
|
|
|
|
Hi
I have upload an ASP.net on Apachi Server. I often get the Error like
Invalid Viewstate Cleint IP X.X.X.X Disconnected.
I got a link on MSDN about this errors but can't understand how to solve this problem.
Please help me out of this problem.
Thanks in advance
Lets work it Out.........!
|
|
|
|
|
So I created a custom control.
I right click the toolbox, chose Add and it added my newly made custom control. That workd and its name appears fine on the toolbox.
So I drag the control on the form.
it produced this register tag
<%@ Register Assembly="WebControls" Namespace="ForumWebControls" TagPrefix="cc1"%>
and this html
<cc1:ForumControl runat="server"></cc1:ForumControl>
But it says the following error.
Error 11 Unknown server tag 'cc1:ForumControl'.
Error 11 Element 'ForumControl' is not a known element. This can occur if there is a compilation error in the Web site.
Does someone know something I did wrong? Do I need to register the schema or something? This works in VS2003, why not VS2005?
Thanks,
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
Nevermind. I added it to my web.config and it works now
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
I wasn't sure where to put this question, but I think the issue is based on what happens after I've queried the database, and what an ASP.net control is doing with the data.
I have a SqlDataSource linked to a Details View. It queries the DB (via a proc) to retreive a bunch of data about a specific record.
I'm having trouble with it, though. Sometimes certain values will return null. The proc left-joins several tables, and sometimes there won't be any results from the joined table (the "left" table is member information. The right table is image information, if there is a picture associated with that member).
I'm getting a Format Exception here (we're in the middle of an edit operation):
<br />
DataRowView rowView = (DataRowView)dvMember.DataItem;<br />
<br />
if (rowView["ImageID"] != null || rowView["ImageID"] != System.DBNull.Value)<br />
imageID = Int64.Parse(rowView.Row["ImageID"].ToString());<br />
Actual error message:
"System.FormatException: Input string was not in a correct format"
if the member in question has no image (this will be used for determining what I need to do for the rest of my updating). I don't know what I need to check for here. I thought null or DBNull would handle it. No dice. So what happens when you pull information from the DB into a datasource? What does it do to null values? Or is my DetailsView doing something to them (tricksome, they can be). I can't seem to find this information anywhere, and my good ADO books are all at home.
|
|
|
|
|
Hi there,
IMO, the simple way to figure out the root cause is to debug your application and have a look at the rowView.Row["ImageID"] , then you can see what is the real value of it. Btw, when do you want to run the posted sample code? Does it run when you select data to the DetailsView control or when you update data?
|
|
|
|
|
I Forgot to mention that, sorry. The watch window is showing that rowView.Row["ImageID"] is null. This is contributing to my bafflement.
What happens on the page is this: user enters a search term in a text box, his search button. A Grid View is populated with matches for that search term. Basic information - name & email - is shown. There's a "view details" link button that makes dvMember visible when clicked, and populates dvMember with all of the individual information about that specific user (and we're doing all the retreival and binding right there). There's a datasource binding dvMember to gvMember & the selected index property (iirc, I'll double check at work monday).
In hindsight, I wouldn't use a second datasource there - part of the goal on this project for me was try and get comfortable with the controls. Since updates and deletes here are multi-table, I think the datasource is just in the way for the most part.
|
|
|
|
|
+ A quick fix is to replace the or (||) operator in the if condition with the and (&&) operator.
grandypeace wrote: There's a datasource binding dvMember to gvMember & the selected index property (iirc, I'll double check at work monday).
Yes, it should be the way you go.
grandypeace wrote: Since updates and deletes here are multi-table, I think the datasource is just in the way for the most part.
Because it's related to multiple tables, you may consider using the ObjectDataSource control.
|
|
|
|
|
minhpc_bk wrote: + A quick fix is to replace the or (||) operator in the if condition with the and (&&) operator.
Ugh, that's a stupid one to get myself into.
minhpc_bk wrote: Because it's related to multiple tables, you may consider using the ObjectDataSource control.
Well, I think if I was doing it all over again I'd probably do that. This is a small project - and it seemed to me at the start that doing actual objects would be a waste of time. Of course, once I got through most of it I had an additional requirement dropped on me - I had to map some of the data into a database in another application (so my multi-table operations became multi-table, multi-DB). I would have saved myself some trouble had I started differently. Live and learn.
|
|
|
|