.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

SP Datasource select Command not working for Status Column

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :SharePoint


    (MOSS 2007-Webuser control Web part)

    I'm having a cutom list that i'm binding using SPDatasource to a gridview. I want to filter the list based on column values. I tried the following code

            SPList taskList = site.Lists["Accounts"];
            SPDataSource mySPDS = new SPDataSource();

         mySPDS.SelectCommand = "<View><Query><Where><Eq><FieldRef Name='Vendor_x0020_Name'/><Value Type='Text'>"+ddlVendorName.SelectedItem.Text +"</Value></Eq></Where></Query></View>";


mySPDS.SelectCommand = "<View><Query><Where><Eq><FieldRef Name='Status'/><Value Type='Choice'>" + ddlStatus.SelectedItem.Text + "</Value></Eq></Where></Query></Vi

View Complete Post

More Related Resource Links

Sharepoint SPDatasource select command where clause not working for some columns



       I'm using MOSS 2007. I'm using spdatasource to bind a custom list to gridview using webuser control(webpart). spdatasource select command working for all columns except the status column. my status column is a choice- radio with the following options. Pending Review, Checked and Approved. I have checked the field internal name, every thing is correct, but only for status column filtering not happening. Gridview coming as blank

i tried using 

             <FieldRef Name='Status'/>
             <Value Type='Choice'>Pending Review</Value>

Any idea?????




Write select query with a paremetrized where clause, and populate database with the retrieved column

I want to be able to retrieve column values using the dropdownlist values as parameters then populate the tbPO table with the retreived values. Where and how do I do it. ImportsSystem.Data.OleDb ImportsSystem ImportsSystem.IO Imports ?directcostDataSetTableAdapters PartialClass po_header  Inherits System.Web.UI.Page  Dim cn As OleDbConnection  Dim cmd As OleDbCommand  Dim dr As OleDbDataReader  Dim icount As Integer  Dim str As String  Dim vendor_id As Object   ?  Public Sub btn_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.ClickTry   context.Items.Add(     cmd.CommandType = System.Data.   cmd.CommandText = Dim context As HttpContext = HttpContext.Current"Company_Name", DropDownList3.Text)Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Users\Owner\Documents\Visual Studio 2010\WebSites\WebSiteJun25\App_Data\directcost.mdb;")Dim cmd As New OleDbCommand()CommandType.Text"insert into tbPO(ponumber, suppliername, ShipTo, basictype, DateNeeded, Purpose,ShippingInstr, ProjId) values(?,?,?,?,?,?,?,?)" cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.Add

Get information about collation of a column of a resultant select query using oledb



I have executed a select query from a table using OLEDB (IID_ICommandText) . Now I want the information about collation(Case Sensitivity,Accent Sensitivity, Kana Sensetivity, Width Sensetivity, LCID) of all the eligible columns of a select query. Can anyone please help me with a way to retrieve all of them.



sql select query not working


hi guys,

i have been having trouble trying to find out what is wrong with my sql select query... i wanted to select a sessionID by comparing the tourID and dates. the dates datatype at the database is datetime and the value of itemSessionDate is in string. i tried to convert itemSessionDate to date and dateAndTime but it gave me mm/dd/yyyy while the date in my database is dd/mm/yyyy hh:mm:ss. so i thought i can try using the itemSessionDate string as it has the same value as the one return from the database. but it keeps on goin to the if not reader.hasRows and quit the statement

could somebody teach me how to solve this problem....

below are my code

Private Function getItemSessionID(ByVal tourID As String, ByVal itemSessionDate As String)
        Dim sessionID As String = ""

        Dim strConn As String = ConfigurationManager.ConnectionStrings("ProrsumDBConnectionString").ConnectionString
        'create sql connection
        Dim myConn As New SqlConnection(strConn)
        'Open connection; Note: You need to open a connection to database

            Dim cmd As String = "SELECT sessionID " & _
                                " FROM TourSession " & _
                                " WHERE tourID=" & Integer.Pars

Row command working on all rows not selected one?



I have this code that hides a column in a gridview.  (The column houses another nested gridview).

    Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
        If e.CommandName = "Select" Then
            If GridView1.Columns(0).Visible = False Then
                GridView1.Columns(0).Visible = True
                GridView1.Columns(0).Visible = False
            End If
        End If
    End Sub

The trouble is that if I click the select link on one row that action to hide is carried out on all rows.  How can I set this up so that it only hides the row that is selected?


BDC Column with Ability to Select Multiple Values


Use Case:

We are creating a storage location for technical product articles. These will be SharePoint publishing pages. Each page will have metadata assigned to it to make it searchable by properties. The possible values for one of the columns (Part Number) could potentially be sourced by our ERP system. I'd like to do this to eliminate the possibility of free-text entry errors, but there are probably over 10,000 parts so a drop-down list isn't feasible.


Ideal Situation:

The end user enters the part number and clicks a button to verify it against a BDC entry from our ERP system. If they weren't sure on the part number they needed, they could do a lookup from that metadata entry screen. They'd need to have the option to add multiple part numbers as one technical product article could reference multiple part numbers.



Is BDC an option for all of this or am I looking at a custom metadata solution? I thought I heard along the way that BDC only supported one value choice, but I couldn't find a verification for that in the forums.



Use BDC data in list as multi-select column

I have a document library that uses values from another system for its metadata.  Right now, we copy the values from the primary system into SharePoint so users can choose them.  I want to find a way to use the BDC connection that I have set up to automatically pull those values.  The problem is that the current metadata is set to multi-select.  So, I have a file that is in the library and it can be used for multiple clients - clients is a column in my library and users can select many entries.  When I set up a column to pull BDC data, it only allows single entry.  Does anyone have any ideas?

Working with In-Memory Open XML Documents (Office Talk Column)

Working with Open XML Documents without loading from a file or saving to a file is important when you build applications that work with Microsoft SharePoint Server 2010 or Microsoft ASP.NET Web applications.

wpf datagridview checkbox column selection not working fine.

Hi Experts,in my c#.net windows based wpf application i added  a datagridview.dynamically i added checkboxcolumn to that datagridview DataGridViewCheckBoxColumn cbCol = new DataGridViewCheckBoxColumn(); GridSource.Columns.Add(cbCol); and another column is string. to this column am hardcoding the values DataTable _datatable = new DataTable(); _datatable.Columns.Add("Name", typeof(string)); _datatable.Rows.Add("CSRs"); _datatable.Rows.Add("Customers"); GridSource.DataSource = _datatable; till here fine am getting two columns (checkbox and Name)when i am trying to check those checkboxes problem comming.am trying to get the count of the checked rows for that i used below code int cbcount = 0; foreach (DataGridViewRow _dgRow in GridSource.Rows) { if ((bool)_dgRow.Cells[0].Value) cbcount++; } cbcount will give the checked count.but the problem raising here if i check 2 rows it giving 1if i check 5 rows it giving 4if i check 1 row it giving me 0means am getting n-1 resultwhere i did wrong??

Copy a column with update and select

Hi, I am using SQL Compact 3.5 I am trying to copy the values of a column called "CODIGO" from one table to another table. I mean, I want to copy the column "CODIGO"  from table  "DATOS_ACADEMICOS" to table "ALUMNOS". I use this code: UPDATE ALUMNOS  SET CODIGO=(SELECT DATOS_ACADEMICOS.CODIGO FROM DATOS_ACADEMICOS WHERE DATOS_ACADEMICOS.ALUMNO_ID=ALUMNOS.ID)   But I get an error in the SELECT statment: Major error 0x80040E14, Minor error 25501 [ Token line number = 2,Token line offset = 13,Token in error = SELECT ]   I also tried this code with the same error: UPDATE ALUMNOS  SET CODIGO = (SELECT DATOS_ACADEMICOS.CODIGO             FROM DATOS_ACADEMICOS             WHERE DATOS_ACADEMICOS.ALUMNO_ID=ALUMNOS.ID) WHERE EXISTS (SELECT 1 FROM DATOS_ACADEMICOS WHERE DATOS_ACADEMICOS.ALUMNO_ID=ALUMNOS.ID)   How can I copy from one column to another in a SQL sentence? Thanks    

can alias in select be used for selecting other column in that table?

Hi All,I want to use an alias name in a select clause to select other column in that table? select   top 1 (   case when CreatedByName <> '' then 'yy'         else 'xx' end) as filName, (filName + 'xx')from Order       But it throws error like " Invalid column name 'fileName'."Could you please help me out?

Select Top X not working

hello,ive a problem with ms access query; im trying to solect top X records and it fails returning > X each time. without the TOP keyword it would filter a lot more records, with TOP keyword it alwasy select more than required; im selecting 4 fields and performing value check on 3 of them, ive noticed that if i limit to different values of TOP it works in some cases while doesnt in others; it seems that it select TOP X records with specific value in the last field grouping the results until it select X records; here is an exaple:id     vi_se  ri_no  coeffaf418    16    27    0.592592592592593de788    18    31    0.580645161290323al452    22    38    0.578947368421053du771    14    25    0.56ns011    15    27    0.555555555555556iv729    15    27    0.555555555555556ge103    15    27    0.555555555555556in this case the effective records are 7 however if you group by coeff they are 5 as requested by the TOP keyword, this is the exact query result, there is no grouping performed on coeff field, in addition in this case the last three valu

Use Data in a Column as Select Button in GridView

I don't want to use the built in "Select" hyperlink that's in the gridview, I'd like to just use the first data column, is there a way to do that or are we forced to use the automatically generated "Select" column.Thanks!

Select column from all tables in database

I want to retrieve the name and phone columns from all the tables in my database not in systables....   Ok this works but i dont want to get it from just the test table I want to get it from all the tables that I create "USE mrpoteat SELECT name, phone FROM mrpoteat.dbo.test where name = name and phone = phone"

Working on a SELECT Output

Hi Please can anyone help me. I've just joined two table together. Next I would like to output the SUM of one of the columns. I am almost a complete beginner so please could anyone give me some pointers on how to do this. Thank you Matthew

parse the Select command in C#

Please i need to find all words starts with '@'  such as input parameter in sql query  ex:(select * from table where date=@enddate)ineed to get the enddate to view it in messageboxAlaa

Out-of-box filter stops working as soon as I "Configure Datasource"

I'm running VWD 2008 Express with ASP.NET 3.5 I realize now that 4 has much better filtering controls, but I didn't realize that when I started my project.  Anyway, when I use the standard List.aspx to display a table, the filtering works just fine (yes, it's only foreign keys and booleans, but it works).  I then modify the linq datasource so that the gridview only displays the columns that I want, and the filter function immediately stops working.  You can choose from the drop down lists, but nothing happens.  As an aside, I don't want to set scaffolding to false for those columns because I do want them to show up in the Edit.aspx page.  My understanding is that scaffolding settings would keep the field from showing up in either page. What do I need to include in either the gridview or the linqdatasource to get the filter working again?   Thanks!
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend