One way to do it is to put in a return field which counts the records that are returned. For instance add Count(FIeldName) As RowsAffected as one of your fields. This will however return an extra field for each row, which may not be a good idea. The reason there is no way for the datareader to know how may rows are returned is that it is still connected to the data and not all rows are retrieved yet. You could count the rows as you use them, through a loop, or if you bind them to a control, count them that way. hope this helps, sivilian
sivilian
Posts
-
How to get number of affected rows -
Save the value of a controlYou should look at the PropertyBag object which was designed for percisely this. hope this helps, sivilian
-
Passing multiple valuesAfter you have validated your fields, you can submit the form using javascript:
document.FORMNAME.Submit();
this will act exactly like a submit button. Make sure that on your Form tag you have an action attribute set to "submit.asp", and a method attribute set to "POST" In the submit.asp page you are able to access the values using Request.Form("NAMEOFCONTROL"). hope this helps, sivilian -
Setting Permissions ProgramaticallyHi, Does anyone know of an API in VB6 (perferably) or any other way to programmatically give a user read access to a folder. I am presently using a product called Dameware, which works fine, but it removes the inheritance on the folder to which I add the user. Any help is appreaciated, thanks, sivilian
-
Image Button with TextYou can use GDI in the System.Drawing namespace to load an image into an obect and manipulate it, (add text to it) and then save it. A common technique in ASP.NET is to set the ResponseStream of an aspx page to the stream containing the image, and change the content type to the image type. This way an aspx page can act as an image and can be set as the image for an image button. hope this helps, sivilian
-
Data not reachingIt is very difficult to say why this is happening without a hands on view of your code. What needs to be done it to debug. I can tell you that the most likely reason is that something is different between the two environments. Also remember that you now have many clients, with many different browsers. Try to pin-point the browsers that are having the problem? I think nothing but good hard digging and research can solve something like this. hope this helps, sivilian
-
How to open a select folder window?There is no built in functionality with this control to do that. I sorta circumvented the problem once by setting the size of textbox part of the control to 0 so it is invisiible and then setting another textbox next to it. Whenever a user chooses a file, the directory of where that file is in would appear in the textbox. There is some coding involved, but it is rather trivial. This is the best quick fix I can offer. sivilian
-
looping through textboxesI do not think there is a way to put textboxes into an array, in a way to loop through them as you are doing. You can however, iterate through the controls on the page:
Private Sub TraverseControls(ByVal container As Control) Dim control As control For Each control In container.Controls If control.GetType.Name = "TextBox" Then CType(control, TextBox).Text = String.Empty End If If control.HasControls() Then TraverseControls(control) End If Next End Sub
You can call this function with Page, but it will set all your textboxes to an empty string. In order to make good use of it, you can put your 6 textboxes in a Panel, and then call the function with that Panel. hope this helps, sivilian -
DataSet and Session variablesI believe that session variables, when used in this way is a caching mechanism. As the cache object is only good application wide, the session object is the ideal method to cache data from individual users and can increase speed. However, the drawback to this is that it can consume lots of memory on the server if you have many users connected concurrently. There is an option to store session information in sql server if this is a problem for you. But as you say, session variables do not keep data up-to-date. This is true, but this is a fundamental issue with web applications in general. You can never keep data up-to-date on clients who do not post back to the server. How much would reloading data on every load help? Another way to do this is to use the viewstate, which is a better way because it does not put any load on server resources. It does slow down page loads since all the data is being past back and forth on every load. hope this helps, sivilian
-
Submitting a form in ASP.NET from ServerSideA popular way to do it in ASP.NET is to use Server.Transfer. This will transfer the execution of the page to the URL specified. It has the same effect of posting or submitting the form to that page, as with the action attribute on the form. One thing you should be careful of though, is to not put anything in the output stream, like Response.Write, before your call to Server.Transfer, because this output will be output in the new page. hope this helps, sivilian
-
ASP.NET IIS ProblemThe reason may be that you have installed VS (I am assuming you are using VS) before you have installed IIS. One thing to try is to register IIS to the .NET Framework. You can do this by going to your Framework folder usually located at: \\WINDOWS\Microsoft.NET\Framework\v1.1.4322 you may have the 1.0 version but it is the same thing, and run the following command: aspnet_regiis -i hope this works for you, sivilian
-
Calling HTML Form Submit from ASP.net serverside codeWhen you set a drop down list (I am assuming this is what you are using) to autopostback, the form its on is automatically submitted when its value changes. The event that handles this is selectedIndexChanged. In this event handler you can put database manipulation code, as it is running on the server side. There is no need for you to submit the form yourself, or to create an invisible form! hope this helps, sivilian
-
ASP.Net debugging error !!!Make sure that you are in the NET debuggers group!
-
Formatting text in datagrid.The reason it does this is that the datagrid renders as an HTML table, and tables do not see whitespace as textboxes, or textareas do, in that they merge whitespace and do not understand line breaks. One way to overcome this is to replace all spaces with and all line breaks with
or. hope this helps, sivilian
-
How do I install ASP.NET on my IIS?!You can associate the version of the .NET Framework that IIS uses by running the aspnet_regiis utility with an -i paramater. It should be in your framework folder usually \\WINDOWS\Microsoft.NET\Framework\v1.1.4322\. hope this does this trick, sivilian
-
Error: Unterminated string constantThis error is probably due to a javascript error. If you are sure that the pages are exactly the same, I would also check the browser versions (SP) to see if they are the same. Nevertheless, the error should probably be fixed. Do a view source and look for any string in javascript that does not have a properly closed quotation mark. hope this helps, sivilian
-
Password Confirm CheckYou can use the CompareValidator. Just set the ControlToCompare to the Confirm TextBox and the ControlToValidate to the first Password Textbox. Also make sure that the type is String and that Operator is equal. hope this helps, sivilian
-
Global Procedures.Create a code module, and put all global functions in there. They can be accessed from anywhere within your project. hope this helps, sivilian
-
Accessing Java Script from Code behindWell you can't really access it as it does not run at the same time. Your code-behind runs server-side and your javascript runs client-side. You could use the RegisterScriptBlocks to add javascript to your HTML, or the Control.Attributes.Add(key, script) function to add javascript event handling to your controls though. If you need to access the result of a javascript function you must take other means, such as putting the result in a hidden text box, and reading it server side. hope this helps, sivilian
-
Application Path at Design TimeThis only works at run time. sivilian