DataSource Controls :: Sql Selecting By Rows By The Containing Input?
Mar 20, 2010
im using this query to select Movies from my DB
[Code]....
now thee thing is it returns only the exact value, and im tryying to get to a point where
the user puts only a letter or maybe part of the movie name and get the results by that
and not only if he puts the exact value, if anyone could should me the right sql syntax i'd be happy.
View 3 Replies
Similar Messages:
Aug 26, 2010
I have a gridview, based on thsi datasource:
[Code]....
Using a dropdownlist, I can filter (by changing datasource) the results based on customer names in a dropdownlist. This datasource, working perfectly, looks like this:
[Code]....
Now, using a textbox and a ajax calendar, I would like to be able to filter on the date as well, but my datasource so far:
[Code]....
doesn't work very good. In some case sit doesnt show anything, in onther situations - with 10 records for a given date, it only shows one.
Question one: How do I make the last datasource work? Its probably - again-again - something with the datetime formats, but for the life of me, I can't see how to do.
Question two: The Ideal solution would be using the first datasource, SqlDataSourceAllLoads, and then be able to filter the results with filterexpressions/parameters, but again, how? The filterparameters would origin from a DropDownListKunder, matching the tblDeliveredInfo.deliveryInfo_FirmaNavn as seen in the second datasource, while the date comes from the textbox txtStartDate (databinding fired by a button).
View 3 Replies
Mar 21, 2011
I have been handling everything in code which is not working consistently same in all scenarios.
View 1 Replies
Oct 17, 2010
How do you select value from a gridview? I would like to pass values of rows selected to a query with the code below, but the grid seems to be frozen and I can't find a property for the grid that allows me to select rows.
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles GridView1.SelectedIndexChanged
Dim DB As New AOP29DBDataContext
If GridView1.SelectedValue = "Receiver" Then
Dim Query = From p In DB.Receivers
Select p
GridView2.DataSource = Query
GridView2.DataBind()
End If
If GridView1.SelectedValue = "Donor" Then
Dim Query = From p In DB.Donors
Select p
GridView2.DataSource = Query
GridView2.DataBind()
End If
End Sub
View 4 Replies
Feb 25, 2010
i have two sqldatasource controls. one i use to display data in textbox's ,filter'd by a select parameter in page behind code. Once checked, i want to copy this data to the other datasource ,by selecting checkbox.Then display this data in detailsview control.
At present the two datasource controls declared , render data to the page simultaneously during pageload. I want to first check data in textbox's from first source, before second datasource is rendered to screen. note, both are filtered by a page variable. i wish to leave the textbox datasource control in situ, as other controls and code depend on it.The other detailsview datasource is my problem?
View 1 Replies
May 31, 2010
I have one big DataTable with X rows. I want to select Y rows from it and bind them to a new ViewList. While doing it, I want to delete these rows from the DataTable (Having X - Y rows).
What is the best and fast way to do it?
I don't know if it is better to create a new DataTable to have the Y and after that bind them to a ViewList or something else?
I'm also looking for example in code how to select/delete rows from DataTable.
View 1 Replies
Jun 17, 2010
[Code]....
In above query I want to have top 10 rows as well as count of all rows.
View 3 Replies
Jun 10, 2010
I want to put an input table on a web page using ASP.NET. The input table has 3 columns: date, quantity, and price. The number of rows is variable, depending on user input. The code behind will read the data and perform the necessary calculations. The data will not go into a database. It would be nice to have some client-side or server-side validation for the data, such as required fields and range checking.
Which control(s) in Visual Studio 2008 will perform what I want to do?
View 1 Replies
Oct 18, 2010
selecting multiple rows in a gridview using ctrl key. (C#, asp.net)
While right clicking on the selected rows, I need to export those particular rows to "word".
View 1 Replies
Jun 8, 2010
I am trying to sum the rows in a gridview. It works find except when I do an update. Then I get the following error:Input string was not in a correct format. The error occurs when it its the Total1 +=gr1.cells(5).text or the Total2 area. Here is my code to sum the rows:
[Code]....
View 7 Replies
May 18, 2010
I have a table in which a field consists of a multiple values like CSE, INF, ECE etc., I want to take only one value from the field like
When an user selects a particular branch like CSE, the user should get the list of Colleges assosiated with the branch CSE. How to do this?
View 3 Replies
Mar 15, 2011
I have three controls a textbox, a drop down and a check box on a webform as below;
[Code]....
I have an SqlDataSource defined and configured with SELETC and UPDATE commands as below;
[Code]....
How can I;
1. Query the SqlDataSource for a specific record (ie ApplicantID = some value) and then read the selected data in the three controls on the webform?
2. Update user changes from the three webform controls back to the SqlDataSource?
View 4 Replies
Oct 5, 2010
I have a gridview with this form
ID_student -------exam_mark1 ------exam_mark2-----average
to calculate the average score I used this code
[Code]....
but it returns me the following error: The format of the input string is incorrect.
View 3 Replies
Oct 10, 2010
I just need to know how to select in c# select from my sql server database for the purpose of seeing if data already exists.. do not need to display the data (i know how to select the data and display it in a data grid) but I am checking to see if dates are already in the database before performing an insert since there can not be duplicate dates... it is late but I only can figure out how to use the data as it applies to viewing or if bound to a control. Also I am not using the aspx... in tags... my c# is seperate... do I have to use a stored procedure just to see if the row exists???
View 5 Replies
Apr 23, 2010
I am trying to do something I thought would be simple but something isn't working for me.
I have a DataTable that I need to sort by a price ascending, then select an 'nth' row value. The 'nth' value is the row count/10.
[Code]....
What happens is I get the "nth" value from the original tblDeals.
View 1 Replies
Jul 8, 2010
I am having a staff table which contain staff information on it. To search staff information from the table, I want to prefer filter style. For example in the select query I want to display staff information according to three criterias. Select staff information from all sections, Select staff information from a given section, select staff information by a given Name. All these selects must be performed in a single select statement. Suppose,
SELECT * FROM StaffDetailsTbl
WHERE SectionID = CASE WHEN @SectionFilter IS NULL THEN [SELECT ALL]
ELSE SectionID = @SectionFilter
and Name = CASE WHEN @NameFilter IS NULL THEN [SELECT ALL]
ELSE Name Like '%@NameFilter%'
Where Declared variables are parameterized stored procedure values retrieved from the user.
View 2 Replies
May 7, 2010
I would like to select some columns from a Datatable, I mean, something like Select Name, Surname, ID,
I'm trying to do something like this:
DataTable dtExcel = new DataTable();
DataRow[] buena = dtExcel.Select("NAME");
in order to get only a view or table with one column (NAME).
View 1 Replies
Sep 19, 2010
I'm having an issue coming up with an appropriate code design to implement a search page using linq to sql for my DDL. I think the best way for me to explain where I'm at is describing what I've done in the past, before linq. Lets say we have a basic search page with various user input controls for search options... for simplicity, let's say there are two main ways the user can search.
1. a dropdown filled with account numbers. When that drop down is changed and an account number is selected, a gridview needs to be populated with all the records for that account.
2. the second way is a dropdown for choosing what field you want to search, a textbox for entering what you want to search for, and a button to execute that search. In the past, just using straight ado.net
I would handle each of these two search options separately within the events of the dropdown list and the button, respectively. In selectedIndexChanged for 1, and in the buttonClick event for 2, I would construct my sqlCommand etc., ultimately returning a dataset or datatable which I would then bind to the gridview. The logic was separated by the two different event handlers. Now, fast forward to linq to sql and I have a similar page layout, but I am using the linqdatasource selecting event to build my where conditions. Now the difference is *everything*, all the logic, is now in this one event handler, which search option did the user run? Could I somehow craft an IQueryable <T> within each of the input controls event handlers (like the button click, or selectedIndexChanged of the dropdown) and pass that in to the linqdatasource's selecting event? that way my logic stays logically separated...
further, after this initial search is done and results are bound to a gridview, I have several other dropdown lists that appear for search refinement. I need to keep track of that top level query, and each of the refinements... and again, right now it looks like everything is going into the linqdatasource selecting event and I get the feeling it shouldn't be... using the selecting event enables my paging and sorting to work, so I want to use that, but again, it's turning out that I'm putting *everything* there, like all the page's logic, and I'm thinking that is not good? if I could just pass in the actually query, like an IQueryable<T>, and keep my logic separated.
View 8 Replies
Jun 14, 2010
I am writting a custom class with which I manipulate the data for my website. I was wondering if there is a way to connect to a database and retreive the column names for a given table with out sellecting any data in the table.
Currently I am using an sql select and connection string to create an SqlComman object. Then I use the command object to create a SqlDataAdapter object which I use to fill a DataSet. At the end of all that I am able to retrieve the column names but I have select data and retreived data.
View 2 Replies
Jan 15, 2010
I'm trying to construct one of my SQL query parameters by building a string inside the DataSource selecting event. This string will be grabbing information from various controls on the page (2 drop down menus and 1 calendar date selector). However, I found that stringbuilder doesn't work inside a selecting event. Is that normal or do I have another hidden problem??
Here is the error I'm getting:
System.Data.SqlClient.SqlException: Procedure 'spProcedure2' expects parameter '@sqlSelect', which was not supplied.
Here is my code inside the selecting event:
System.Text.StringBuilder selectValues = (System.Text.StringBuilder)ViewState["SelectedValues"];
selectValues.Append("EXEC spProcedure1 ");
ArrayList selectedDates = (ArrayList)ViewState["SelectedDates"];
if (!IsPostBack)
[Code]....
I'm using Visual Web Developer 2008 and SQL Server 2000.
View 8 Replies
Sep 23, 2010
in the selected event it seems even though e.TotalRowCount really is the total row count, when I cast e.Result to a type in order to access the actual data only the current page of data is there? not all.
IEnumerable<InventoryGridItem> items = (IEnumerable<InventoryGridItem>)e.Result;
items only has the 15 records for the current gridView page, not all the records, is this normal? If I need to access all the items in the result do I need to stick with the selecting event instead?
View 2 Replies
Feb 28, 2010
I try to implement a very simple search but my LINQ and MVC passing of parameter skills are not existing yet.
In SQL I want to do SELECT ItemName, ItemDescription FROM ahn_search WHERE ItemDeschription LIKE '%'+@input+'%'.
Could someone please help me to get any closer ?
[Code]....
View 7 Replies
Jun 9, 2010
I need to have search form in my web app . I want visitor input text in textbox control and when he click on Search button it check DB table for his input text.
I dould like if user input "Windows 7" and I have the sentence in DB Records as "My be Some Windows Generation .." it list this record.
in other word I want to search for any word that users entered in DB.
Could any one tell me efficient way instead of split input text to words and then execute search query per word?
View 3 Replies
Feb 2, 2010
Having a bit of trouble with a logon page I created using text boxes for a User ID number and a password.
Basically, my original design was to have a textbox for a username and one for a password. Due to some complications, I changed the username to the User ID number input and as such, the input credentials went from being a string to an integer. I've changed this successfully, however when I now type in a string, rather than the integer it requires, the page fails.
how to edit this so if a user enters a string value instead of a numeric value, an error message can show up on a label instead of the whole project coming to a halt because of an error?
Here's the code I have for the page so far, which does the job (apart from this problem!)
using System;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.SqlTypes;
[Code]....
View 2 Replies
Jan 8, 2010
I am trying to test a SPROC from my ASP.net page by passing a date from my page or from visual studio server manager.
The date value is like so 2009-01-01.
I keep getting an error message this input parameter cannot be converted.
I tried all combinations like '2009-01-01', "2009-09-01" , 20091001.
Nothing seems to work.
But the SPROC works on the SQL side just fine.
View 1 Replies