Web Forms :: Deal With Many Parameter Boxes Firing Database Queries?

Jul 22, 2010

I am very new on the C# and ASP scene and am after some advice on how to handle a senario. I have a asp website with 10 text boxes. These boxes form the basis of a user completed parameter selection. There is a button that will fire the query. The compliction is that some of the textboxes may be left blank and any combination may be filled in.

The only way i could think to do this is with countless IF statements. The user clicks the button and the process checks out the senarios and runs the corresponding SQL statement. The problem with this is that there are a vast amount of possible senarios depending on whether the user completes one box, all boxes, or a mix of any of them. The SQL query is the same for each senario bar the WHERE statement which changes depending on which text boxes are filled in. Is there another way of doing this or do i really need to write every possible senario out in full?

View 14 Replies


Similar Messages:

Web Forms :: Custom Validator Validates Three Text Boxes And Give Errorto Fill The Boxes

Apr 20, 2010

I have a custom validator which validates three text boxes. my code is,

[Code]....

I fill in all the three textboxes.it still gives me the error message to fill in all the boxes and does not submit the page even when all the three boxes are filled.

View 3 Replies

Avoid Too Many Queries Repeatedly To Database

Aug 31, 2010

Among methods: static variables, viewstate, session and cache for avoiding on loading repeatedly and less making queries to the database. What do you think the best method of the 4 above? I Think Cache is the best one? Or any other methods better in Asp.net 3.5 or higher?

View 3 Replies

Projecting Simultaneous Database Queries

Aug 17, 2010

I'm after some thoughts on how people go about calculating database load for the purposes of capacity planning. I haven't put this on Server Fault because the question is related to measuring just the application rather than defining the infrastructure. In this case, it's someone else's job to worry about that bit! I'm aware there are a huge number of variables here but I'm interested in how others go about getting a sense of rough order of magnitude. This is simply a costing exercise early in a project lifecycle before any specific design has been created so not a lot of info to go on at this stage.

The question I've had put forward from the infrastructure folks is "how many simultaneous users". Let's not debate the rationale of seeking only this one figure; it's just what's been asked for in this case! This is a web front end, SQL Server backend with a fairly fixed, easily quantifiable audience. To nail this down to actual simultaneous requests in a very rough fashion, the way I see it, it comes down to increasingly granular units of measurement:

Total audience
Simultaneous sessions
Simultaneous requests
Simultaneous DB queries

This doesn't account for factors such as web app caching, partial page requests, record volume etc and there's some creative license needed to define frequency of requests per user and number of DB hits and execution time but it seems like a reasonable starting point. I'm also conscious of the need to scale for peak load but that's something else that can be plugged into the simultaneous sessions if required. This is admittedly very basic and I'm sure there's more comprehensive guidance out there. If anyone can share their approach to this exercise or point me towards other resources that might make the process a little less ad hoc

View 1 Replies

Count SQLClient Database Queries From App

Aug 30, 2010

I need to do some performance testing for an ASP.NET MVC application and specifically want to measure how many database queries each HTTP request results in. The data access layer is using LINQ-to-SQL. I'd like to be able to automate the tests so am looking for a good way to be able to do a before and after count of the number of SQL queries. The possibilities I can think of are: A performance monitor counter for the ASP.NET process, A system table in the MSSQL database that can be queried before and after each page request, A property somewhere in the System.Data.SQLClient namespace that tracks the number of queries executed by the process. Has anyone done this before and can perhaps point my down the right path?

View 1 Replies

Forms Data Controls :: Database Results Shown In Expandable Boxes Based On Group Name?

Oct 8, 2010

I haven't been using asp.net for that long and i am wondering if i can use a datalist, repeater, etc to pull data from a database, into one of these, but then group them by group with expandable boxes.

I have a SQL database set up, it will be used to list applications upon a webpage. e.g. office.

So colums are id, pro_name, pro_link, group_name, icon_name

I can extract the data but i am unsure on how to get it to display in the way that i want, as i wish it to show it so it is like below

[code]...

View 1 Replies

Forms Data Controls :: Gridview - Save Selected Values And Checked Boxes In Database

Feb 2, 2010

I have a gridview and users would select some records and would click on the submit button and i will be saving those records into database using a stored proc.... now .... just below the gridview and above the submit button there are few checkboxes by default they wud be checked. How would i save the selected values and the checked boxes in database i wrote the stored proc for the gridview but how would i save the checked checkboxes into the same table.

For i As Integer = 0 To gvSelectScreen.Rows.Count - 1
Dim chkTemp As CheckBox = TryCast(gvSelectScreen.Rows(i).FindControl("cbStatus"), CheckBox)
If chkTemp.Checked Then
ContractNumber = gvSelectScreen.Rows(i).Cells(0).Text
ClientProgramNumber = gvSelectScreen.Rows(i).Cells(1).Text
ClientProgramName = gvSelectScreen.Rows(i).Cells(2).Text
StartDate = CType(gvSelectScreen.Rows(i).FindControl("txtStartDate"), TextBox).Text
EndDate = gvSelectScreen.Rows(i).Cells(5).Text
Dim connStr As String = ConfigurationManager.ConnectionStrings("MainConnectionString").ConnectionString
Dim myCon As New SqlConnection(connStr)
Dim cmd As New SqlCommand("usp_ParametersFromGrid")
Dim dt As New DataTable
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@ContractNumber", SqlDbType.VarChar, 22).Value = ContractNumber.ToString()
cmd.Parameters.Add("@ClientProgramNumber", SqlDbType.VarChar, 22).Value = ClientProgramNumber.ToString()
cmd.Parameters.Add("@ClientProgramName", SqlDbType.VarChar, 100).Value = ClientProgramName.ToString()
cmd.Parameters.Add("@StartDate", SqlDbType.VarChar, 20).Value = StartDate.ToString()
cmd.Parameters.Add("@EndDate", SqlDbType.VarChar, 20).Value = EndDate.ToString()
cmd.Parameters.Add("@RequestID", SqlDbType.VarChar, 50).Value = RequestID.ToString()
cmd.Connection = myCon
myCon.Open()
cmd.ExecuteNonQuery()
myCon.Close()
End If

Now above the submit button as i said, there are few checkboxes and they are checked by default...how would i save the selected item (in the gridview and the checked checkbox values in the same row in the database(sql server)

View 5 Replies

To Make Queries To An Access Database Programmatically?

Feb 26, 2010

VWD 2008 Express. Visual Basic.

I know how to create an AccessDataSource on my aspx page and how to use the datasource to populate gridviews, etc. But I want to know how I can programmatically populate a dataset by querying an Access database. How do I make queries to an Access database programmatically?

View 8 Replies

Database Queries - Compiled Vs Uncompiled DB Qualifiers

May 7, 2010

We have an ASP.NET application that uses SQL statements, where table names are unqualified. When compiled, it works fine, but when uncompiled, it complains and errors out, saying these tables dont' exist. (Qualified name looks like Select * from MyDatabase.mySchema.MyTable; Unqualified like Select * from MyTable) If you try these queries on the database, by yourself, it will take only the qualified names. What's going on? I thought Compiled vs Uncompiled apps should perform the same way codewise.

View 2 Replies

AJAX :: Add Queries In To Database Without Page Refresh?

Mar 29, 2010

How to add queries in to database using ajax (without page refresh).

View 1 Replies

C# - Efficient And Proper Linq Queries From Database

Nov 9, 2010

A sample linq query from MSDN: var expensiveInStockProducts = from p in products where p.UnitsInStock > 0 && p.UnitPrice > 3.00M select p; Does this query select EVERY column from the database table immediately, or does it return some sort of pointer that retieves the actual column data on demand? ie. If there are 50 columns in my table and I only use a single p.UnitsInStock in my actual code, then am I retrieving 50 times more data than I expected?

View 2 Replies

Forms Data Controls :: Space In Text Boxes & Drop Down Lists / Text Boxes Gets A One Tab Spacing?

Jan 20, 2011

Using C# and SQL as the database.I have a page with a gridview and some text boxes and drop down list boxes. A user selects a record from the grid view I query the database and fill the text boxes and drop down list boxes.

Some fields get updated periodincally thus there is no data in those fields in the database until some time.

A strange thing happens.When filling data some text boxes gets a one tab spacing .

View 1 Replies

Add To A Database With Text Boxes?

Apr 12, 2010

can anyone give me a step step guide of how add data to a data base( access 2003 with oledb connection) use vb 2005 asp.net aspx pages via text boxes with a button to submit

View 2 Replies

Security :: Stop The Repeated Database Queries For Roles?

Aug 24, 2010

We have a web application using VS 2008, c#. We try to filter siteMap nodes based on security roles. We have our customized the mether GetRolesForUser() in RoleProvider class to determine a user's role. In this method, roles will be returned by querying an SQL Server database. However, we found that each time a page was loaded/refershed, this GetRolesForUser() was called, and the database would be queried. This is too MUCH and expensive. We thought the roles should be queried only once when a user logs in. After that, role info should be stored somewhere for this user, rather than query DB all the time.

View 3 Replies

ADO.NET :: Select Statement To Called Queries Table In Database?

Sep 2, 2010

anyone know that can we used select statement to called queries table in database or not?usually people used select statement to called common table in database.

View 4 Replies

C# - Update SQL Database With Values From Text Boxes

Jun 6, 2010

User enters values into text boxes (personal information etc.) and then presses a save changes button. The values in these text boxes get stored in an SQL database. The problem I have is that when updating the database using the values from the text boxes, the page refreshes and the values in the text boxes are lost (or rather they return to the values that are already in the database as the data from the database is loaded into the text boxes on Page_Load). When I update the database using valuse stored in variables it all works fine. What is the best way to update with the values from the text boxes?

View 2 Replies

DataSource Controls :: Table / Database Design Theory - Return Faster Queries

Feb 5, 2010

In general terms, which way will require more server processing power and which way will return faster queries... if there is even a difference. The client's database is still on the dev MS SQL server but is essentially but the client has decided they want to collect two more fields of information. Both fields are going to be collection text data and probably varchar(300) will be sufficient for the column data types. Would it ultimately be more efficient to

Add two additional columns in the main table so the data is entered directly into each record, or Add an additional table (or two) with a foriegn key to the primary table that holds the info for each new field The SELECT statement for the main table could be modified to either add the new columns (a.NewColumn1 and a.NewColumn2) or it could contain nested SELECT statements that pull in the data from the other tables. Custom daisy-chained Insert or Update statements would be no problem and a cascade Delete relationship would take care of any deletions. I'm just trying to figure out which would be better from a performance standpoint?

View 3 Replies

C# - Using A Few Text Boxes To Display And Save Data To Database?

Feb 11, 2011

Let's say I have a db table like so:Then I have a product edit form that has 3 textboxes in which the user can save up to 3 different notes for a specific product. What is the best way to handle populating and then saving the data? If I use the code below to display it, how do I save it, as the textbox doesn't know the id of the note is.

[code]...

View 1 Replies

ADO.NET :: Insert Data From Text Boxes On ASPX Page Into SQL Database Using VB?

Oct 4, 2010

This is what I have come up with, but when I run it I get the following error (I decided to just try to use a simplified table just to get an understanding of the basic concepts):

Partial Class label_form
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
' Declaring variables

[Code]....

View 3 Replies

Forms Data Controls :: Access Database Data Into Text Boxes?

Jun 9, 2010

I have to create some code for my website which will bring data from a database into my specific boxes. I have a map on my site which on click of a hotspot, a page will pop up showing a smaller map and the data underneath it. The data will be in text boxes. How do I get the data from the database into these text boxes?

View 3 Replies

Web Forms :: What's The Best Way To Deal With The GridViews In This Update Panel

Jul 15, 2010

I have a toolkit tabbed container with an update panel in the bottom of each of the tabbed container's content template. There is also a radio button list an, a text box and a button. The user chooses the search criteria with the radio button list. They then enter the search text in the text box and hit the search button.

The update panel is then going to display the appropriate grid view and results, depending on what radio button was chosen. The logic to check the radio buttons is in the click event of the search button. I currently have one of the grid views and set it's visible property to true in the logic that checks to see which of the radio buttons was selected. My plan so far is to continue adding the other gridviews and doing this the same way with them. This will toggle the correct Grid View on.

I'm wondering if there is a better way of dealing with the Grid Views. There will be one of three to be displayed with in this update panel. They will have different result sets from different tables. Is my approach for turning them off and on with the visible property a bad idea? Should I be doing all of the ODS and grid view stuff programmatically? Is there a better way of doing this?

View 2 Replies

DropDown List Boxes And Get The Value Of It Both Boxes?

Mar 26, 2010

I have two dropdown list boxes I select the first one and I get the index value of what i selected say item number 2,Using that indexvalue I would like to acccess the second dropdown box and get the value of it Both boxes will have the same amount of items in it.

View 4 Replies

Web Forms :: How To Deal If Internet Explorer Cannot Display The Webpage

Feb 2, 2010

I have a problem.when i create a new web site and browse it with IE8 ,there is error(Internet Explorer cannot display the webpage) and now i am working with VS2008 and IE8.but i also have an older version of VS(VS2005) on the same computer.when i created a new web page with 2005 ,there is no problem and everything is ok. what is the problem with VS2008??i uninstalled it and reinstalled.but there is same error.i tried VS2008 on the another computer and i had no problem.

View 2 Replies

Web Forms :: Deal With NULL Values With Regex Validator?

Jun 26, 2010

I have some fields in my db that have a value of "NULL". These are displayed in the Data controls as "NULL". When I try to commit an update the Regex validator is catching this and not allowing the update because it doesn't match the pattern of the regex.

I've thought of one way of solving this, which is to add the value "NULL" to the pattern for the regex. I'm curious though if there is a better way to solve this issue.

View 3 Replies

Create Text Boxes Dynamically Want To Bind Autosuggest With The New Created Text Boxes?

Feb 3, 2011

i can use auto-suggest with the text box txtCode like this...

as_jsonReportingTo = new bsn.AutoSuggest('<%= txtCode.ClientID %>', optionsRe);

Now I will create text boxes dynamically, i want to bind autosuggest with the new created text boxes. What should I do?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved