How To Get Number Of Records A Query Has Returned Using SqlDataSource Control?
May 17, 2007Hi,
I'm using SqlDataSource control.
Is there a way to know how many records a query has returned?
Hi,
I'm using SqlDataSource control.
Is there a way to know how many records a query has returned?
In my ASP page, when I select an option from the drop down list, it has to get the records from the database stored procedure. There are around 60,000 records to be fetched. It throws an exception when I select this option. I think the application times out due to the large number of records. Could some tell me how to limit the number of rows to be returned to avoid this problem. Thanks.
Query
SELECT @SQLTier1Select = 'SELECT * FROM dbo.UDV_Tier1Accounts WHERE CUSTOMER IN (SELECT CUSTOMERNUMBER FROM dbo.UDF_GetUsersCustomers(' + CAST(@UserID AS VARCHAR(4)) + '))' + @Criteria + ' AND (number IN (SELECT DISTINCT ph1.number FROM Collect2000.dbo.payhistory ph1 LEFT JOIN Collect2000.dbo.payhistory ph2 ON ph1.UID = ph2.ReverseOfUID WHERE (((ph1.batchtype = ''PU'') OR (ph1.batchtype = ''PC'')) AND ph2.ReverseOfUID IS NULL)) OR code IN (SELECT DISTINCT StatusID FROM tbl_APR_Statuses WHERE SearchCategoryPaidPaymentsT1 = 1))'
When querying a bit field, I am encountering a problem with MS SQLServer returning a larger number of records for a table than theactual number of records that exist within that table.For example, my customer table has 1 million unique records, so theresults of the following query are as such:select count(customer_nbr) from customer = 1,000,000There is bit field in the customer table that denotes whether acustomer has placed an order with us called. That flag is calledorder_flagIf I run the following query:select count(customer_nbr) from customer where order_flag = 1The result is 3,000,000 records.There is no logical way that this is possible, as my table onlycontains 1,000,000 unique records and the number of customers with anorder should be a subset of this.If a run the above query with a distinct before customer number, I getthe results I want:select count(distinct customer_nbr) from customer where order_flag = 1600,000 records.So while I can get to the answer I want, I have no idea why I amreturning incorrect values if I don't select distinct.Can anyone help? I checked microsoft support and message boards buthaven't seen anything.I should note that the bit field is indexed.I am not sure if that isthe problem or not.
View 1 Replies View RelatedWhat is the easiest way to obtain number of records in SQLDataSource (using select statement)/GridView. All that I've found in forums seems to be very difficult for such trivial task... Thank you!
View 4 Replies View RelatedI would like to make a listbox only appear if there are results returned by the SQL select statement. I want this to be assessed on a click event of a button before the listbox is rendered.I obviously use the ".visible" property, but how do I assess the returned records is zero before it is rendered?
View 3 Replies View RelatedHi,
ive a table of over 90,000 records . is ther any method for restricting the number of records returned by a SELECT query
i want to implement a query system which will give me the first 50 records, next 50 ,... and so on
can ne body help ?
I am trying to return the number of records found by the query but keep seeing -1 in label1. This query should return many records.
sub findcustomers(sender as object,e as eventargs) dim connection1 as sqlconnection=new sqlconnection(...) dim q1 as string="select * from tblcustomers where store='65'" dim command1 as sqlcommand=new sqlcommand(q1,connection1) dim a as integer command1.connection.open() a=command1.executenonquery() label1.text=a.tostring() command1.connection.close() end sub
What am I doing wrong?
What I would like to do is to have a TSQL Select return the number of records in the Result as if TOP (n) had not been used. Example:I have a table called Orders containing more than 1.000 records with OrderDate = '2015/07/21' and my client application has a threshold for returning records at 100 and therefore the TSQL would look like
SELECT TOP (100) * FROM Orders Where OrderDate = '2015/07/21' ORDER by OrderTime Desc
Now I would like to "tell" the client that only 100 of 1.000 records are shown in the client application grid. Is there a way to return a value indicating that if TOP (100) had not been used the resultset would have been 1.000. I know I could create the same TSQL using COUNT() (SELECT COUNT(*) FROM Orders Where OrderDate = '2015/07/21' ORDER by OrderTime Desc) and return that in a variable in the SELECT statement or even creating the COUNT() as a subquery and return it as a column, but I would like to avoid running multiple TSQL's. Since SQL Server already needs to select the entire recordset and sort it (ORDER BY) and return only the first 100 the total number of records in the initial snapshot must somehow be available.
I'm using the query desinger in ASP.NET , however the number of recordsin the resultset are not displaying, so I cut and paste it into Queryanalyzer which is silly.How do I set this in the output window, or result grid?Thanks Moe
View 1 Replies View RelatedI have a strange problem. I have some code that executes a sql query. If I run the query in SQL server query analyzer, I get a set of data returned for me as expected. This is the query listed on lines 3 and 4. I just manually type it into query analyzer.
Yet when I run the same query in my code, the result set is slightly different because it is missing some data. I am confused as to what is going on here. Basically to examine the sql result set returned, I write it out to an XML file. (See line 16).
Why the data returned is different, I have no idea. Also writing it out to an XML file is the only way I can look at the data. Otherwise looking at it in the debugger is impossible, with the hundreds of tree nodes returned.
If someone is able to help me figure this out, I would appreciate it.
1. public DataSet GetMarketList(string region, string marketRegion)2. {3. string sql = @"SELECT a.RealEstMarket FROM MarketMap a, RegionMap b " + 4."WHERE a.RegionCode = b.RegionCode"; 5. DataSet dsMarketList = new DataSet();6. SqlConnection sqlConn = new SqlConnection(intranetConnStr); 7. SqlCommand cmd = new SqlCommand(sql,sqlConn);8. sqlConn.Open();9. SqlDataAdapter adapter = new SqlDataAdapter(cmd); 10. try11. {12. adapter.Fill(dsMarketList);
13. String bling = adapter.SelectCommand.CommandText;//BRG 14. dsMarketList.DataSetName="RegionMarket"; 15. dsMarketList.Tables[0].TableName = "MarketList"; 16. dsMarketList.WriteXml(Server.MapPath ("myXMLFile.xml" )); // The data written to 17. myXMLFile.xml is not the same data that is returned when I run the query on line 3&4 18. // from the SQL query 19. } 20. catch(Exception e) 21. { 22. // Handle the exception (Code not shown)
Hi,This is a very simple question but I don't have any idea of how to do it.Says I have a table with 50 records. How do I know the number of record have been return by sqldatasource when it execute a SELECT sql statement that contains a WHERE clause. Says the 30 records match the SELECT statement, what code do I have to write in order to display the number 30? Thanks
View 1 Replies View RelatedI would like to use the value returned from my SqlDataSource SELECT method, in the INSERT method for the same SqlDataSource.
Any ideas how this is done?
Hello and thank you taking a moment. I have created a simple login page where the user will pass credentials. I have a sqldatasource that will query a database to see if the user exists. What I would like to do is have the user click a button after entering their credentials. When the button is clicked I would like the SqlDatasource SelectCommand to fire and if there are rows returned then redirect the user to a new page.
I know I can do this with ADO and a datareader with the HasRows property. But what I would eventually like to do is cache the data and then bind the cached data to a control(like a dataview) on the page the user is redirected to. If anyone can tell me how to get the Select command to fire on a button click I would be eternally grateful. Any help will be greatly appreciated.
Thanks,
Jason
SQL query to understand the names of all the available tables , number of records in these tables and size of these tables?
View 4 Replies View RelatedI have a sql data source that runs a query that returns a users data (See below). I want to set the session variable "UserID" equal to the tkinit. How do I "bind" the session to a column from this select command? I tried this Session("UserID") = ("tkinit") but that doesn't work. I can hard code a session value, just can't figure out how to "bind" it from the sqldatasource..
<asp:SqlDataSource ID="getUserID" runat="server" ConnectionString="<%$ ConnectionStrings:xxxConnectionString %>" SelectCommand="SELECT [tkinit], [tklast], [tkfirst], [tkfirst]+' '+[tklast] as fullname FROM [yyy] WHERE ([login] = @login)"><SelectParameters><asp:Parameter Name="login" Type="String" /></SelectParameters></asp:SqlDataSource>
We have some requirement in PowerBI reports. Here we have a table and having Date, Events columns. Below is the sample data..we are creating a measure to calculate the average of the event count for month.We need a measure for calculating Average of Event count per month= sum(Events for a month)/numberofdays in the month.Example for January month : sum(343423)/31 (31 number of days in January)
When we write this measure using DAX query in Excel we are getting semantic error.Tried sample formula : Average:=SUM([Events])/EOMONTH([EventDate],1)
writing this DAX command for measure.After having this data ready, we are creating PowerBI reports on this data.
please explain selectparameters and conflict detection property within sqldatasource control
mohsen
hi friends,
I created sqldatasource control. In select command i written the query like this "select * form emp" and bounded in grid.How can I change the query for searching the details according the date wise when i click the search button.
Hello experts
i have a SqlDataSource Control on my web form. Here is the source for the control
<asp:SqlDataSource ID="sqlSearchDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:DbefomsConnectionString %>"
SelectCommand="SELECT [icon], [file_name], [path] FROM [tblfile] WHERE ([file_name] = @file_name)">
<SelectParameters>
<asp:ControlParameter ControlID="txtSearch" DefaultValue="0" Name="file_name" PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
This control displays icon, file_name, path in GridView Control
The problem is How can i store the above field values in an asp.net variable.
Thanks
Regards
Ali
Do you have to use the sqldatasource in conjuction with another control like gridview or dropdown list?
I'd like to check to see if a record exists in one table before inserting data into another.
thanks
Hello.I'm new to ASP.NET and trying to write data to a Microsft SQL Server. I have created a SqlDataSource control, which is 'connected' to my SQL server.Now my question is how i can put data in the database throw the control, and read data from it. I've read the site, but it's still unclear for me..Greetings!
View 1 Replies View RelatedHow do you set a timeout for an SqlDataSource control?
View 1 Replies View RelatedAnyone can help me ?
View 4 Replies View RelatedHello:
I am having a little issue with an error that is frustrating me. I have a SqlDataSource within an asp:label control and also have a two dropdownlists inside that asp:label control also. When I select from the first dropdownlist, it should enable the second dropdownlist with the populated data, but instead I receive.
The SqlDataSource control 'sqlGetMLSByCity' does not have a naming container. Ensure that the control is added to the page before calling DataBind.
Any ideas why this would be? Here is the web from portion:
<asp:Label ID="recip_form_request" runat="server" Visible="false"> <ul> <li>Step one: Select listing type.</li> <li>Step two: Select the City that you are reciprocating to.</li> <li>Step three: Complete the Recip Form.</li> </ul> <asp:DropDownList ID="recip_form_type" runat="server" AutoPostBack="true" Visible="False"> <asp:ListItem Value="0" Text="(Select Form)"></asp:ListItem> <asp:ListItem Value="1" Text="Residential"></asp:ListItem> </asp:DropDownList> <br /> <asp:DropDownList ID="outside_assoc_cities" runat="server" AutoPostBack="True" Enabled="False" DataTextField="city" DataValueField="id" Visible="False"></asp:DropDownList><br /> <asp:Label ID="city_mls_desc" runat="server"></asp:Label><br /> <asp:Button ID="page1_btn" runat="server" Text="Next >>" Visible="False" /> <asp:SqlDataSource ID="sqlCities" runat="server" ProviderName="System.Data.SqlClient" ConnectionString="<%$ AppSettings:connectionstring %>" SelectCommandType="Text" SelectCommand="SELECT id, city FROM tCityMaster"></asp:SqlDataSource> <asp:SqlDataSource ID="sqlGetMLSByCity" runat="server" ProviderName="System.Data.SqlClient" ConnectionString="<%$ AppSettings:connectionstring %>"> <SelectParameters> <asp:ControlParameter ControlID="outside_assoc_cities" Name="City" /> </SelectParameters> </asp:SqlDataSource></asp:Label>
then the code behind:
Protected Sub outside_assoc_cities_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles outside_assoc_cities.SelectedIndexChanged If outside_assoc_cities.SelectedIndex > -1 Then Dim ItemId As Integer = Integer.Parse(outside_assoc_cities.SelectedValue) Dim MLSID As String = Nothing
Dim cmd As New SqlCommand Dim con As New SqlConnection cmd.Connection = con
Dim sqlGetMLSByCity_sql As SqlDataSource = CType(Page.FindControl("sqlGetMLSByCity"), SqlDataSource) 'using connectionstring from SqlDataSource Control con.ConnectionString = sqlGetMLSByCity_sql.ConnectionString 'con.ConnectionString = sqlGetMLSByCity.ConnectionString
cmd.CommandType = CommandType.Text cmd.CommandText = "SELECT mls_id FROM pwaordev..tCityMaster WITH(NOLOCK) WHERE ID=@ID"
cmd.Parameters.Add("@ID", SqlDbType.Int, 4).Value = ItemId
Try con.Open() MLSID = cmd.ExecuteScalar con.Dispose() cmd.Dispose() Catch ex As Exception con.Dispose() cmd.Dispose() Response.Write(ex.ToString()) End Try
'Further logic to display button depending on MLS If Not String.IsNullOrEmpty(MLSID) Then If MLSID = "B" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is Greater South Bay MLS." page1_btn.Visible = True ElseIf MLSID = "A" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is Big Bear BOR, MLS, which is not covered by Pacific West Association of REALTOR®, please contact us for more information." page1_btn.Visible = False ElseIf MLSID = "C" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is Combined L.A./Westside MLS." page1_btn.Visible = True ElseIf MLSID = "F" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is Crisnet MLS, which is not covered by Pacific West Association of REALTOR®, please contact us for more information." page1_btn.Visible = False ElseIf MLSID = "Y" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is DCAoR - Yucca Valley Area, which is not covered by Pacific West Association of REALTOR®, please contact us for more information." page1_btn.Visible = False ElseIf MLSID = "D" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is Desert Area MLS." page1_btn.Visible = True ElseIf MLSID = "L" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is i-Tech Glendale/Pasadena." page1_btn.Visible = True ElseIf MLSID = "M" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is MRM - Multi-Regional MLS." page1_btn.Visible = True ElseIf MLSID = "R" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is RIM - Rim of the World MLS, which is not covered by Pacific West Association of REALTOR®, please contact us for more information." page1_btn.Visible = False ElseIf MLSID = "G" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is SDI - San Diego, which is not covered by Pacific West Association of REALTOR®, please contact us for more information." page1_btn.Visible = False ElseIf MLSID = "S" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is SOCAL MLS - Southern California MLS." page1_btn.Visible = True ElseIf MLSID = "T" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is Outside Area, which is not covered by Pacific West Association of REALTOR®, please contact us for more information." page1_btn.Visible = False End If 'test.Text = MLSID 'If test.Text = "L" Then 'mls_text.Text = "i-Tech" 'End If End If End If End Sub
Any help would be great, thank you!
I have an SqlDatSource that I have fully setup at design time, but I don't want it to open and load as soon as the page loads, instead I want to open it based on a condition.
How do you do that with a DataSource?
I know that I can simply remove the Select query, and then set it at run time, but I'm looking for something better, that allows me to have the Select query set at design time, in part because I have a lot of parameters.
Hello:
I have two SqlDataSource controls on two different pages: one is updating a table and the other is reading from the same table.
Now is it possible that the reader SqlDataSource control can be refreshed immediately (to reflect updates) when the other control updates the table?
Hello all,
I am trying to update the record which involed the modification of key in Datakeynames, but when i click the update button from gridview, it doesn't allow to change the value of modified column.
<asp:SqlDataSource ID="SqlDataSource1" runat="server" DataSourceMode="DataSet" ConnectionString="<%$ ConnectionStrings:WebsiteDataConnection %>" OldValuesParameterFormatString="old_{0}" SelectCommand="SELECT * FROM [ServiceAgents]" InsertCommand="INSERT INTO ServiceAgents VALUES(@Ser_STATE, @Ser_CITY, @Ser_AGENT, @Ser_PHONE, @Ser_EQUIPMENT)" UpdateCommand="UPDATE ServiceAgents SET AGENT=@AGENT, PHONE=@PHONE WHERE (STATE=@STATE and CITY=@CITY and AGENT=@old_AGENT and EQUIPMENT=@EQUIPMENT)" DeleteCommand="DELETE FROM ServiceAgents WHERE (STATE=@STATE and CITY=@CITY and AGENT=@AGENT and EQUIPMENT=@EQUIPMENT)" > <UpdateParameters> <asp:Parameter Type="String" Name="AGENT" /> <asp:Parameter Type="String" Name="PHONE" /> <asp:Parameter Name="old_AGENT" /> <asp:Parameter Type="String" Name="STATE" /> <asp:Parameter Type="String" Name="CITY" /> <asp:Parameter Type="String" Name="EQUIPMENT" /> </UpdateParameters> <InsertParameters> <asp:ControlParameter Name="Ser_STATE" ControlID="TextBox_state"/> <asp:ControlParameter Name="Ser_CITY" ControlID="TextBox_city"/> <asp:ControlParameter Name="Ser_AGENT" ControlID="TextBox_agent"/> <asp:ControlParameter Name="Ser_PHONE" ControlID="TextBox_phone"/> <asp:ControlParameter Name="Ser_EQUIPMENT" ControlID="TextBox_equip" /> </InsertParameters> <DeleteParameters> <asp:Parameter Type="String" Name="STATE" /> <asp:Parameter Type="String" Name="CITY" /> <asp:Parameter Type="String" Name="AGENT" /> <asp:Parameter Type="String" Name="EQUIPMENT" /> </DeleteParameters> </asp:SqlDataSource>
Does anyone got any ideas about it? Where is wrong in the control?
I have a SQLDatasource control on a web page. It is the datasource for a gridview control.I want the gridview to show all jones if the FirstName textbox is left blank or empty. Right now I have to put a % in the FirstName textbox to get what I want. If I make the FirstNameTextBox empty or remove the % from the FirstNameTextbox it returns all the names in the database no matter what the last name is.How do I get it to work without having to use the % in the FirstName Textbox? THANKS!FilterExpression="LastName LIKE '%{0}%' and FirstName LIKE '%{1}%'"><FilterParameters> <asp:ControlParameter ControlID="LastNameTextBox" Name="LastName" PropertyName="Text" DefaultValue="" /> <asp:ControlParameter ControlID="FirstNameTextBox" Name="FirstName" PropertyName="Text" DefaultValue="" /></FilterParameters>
Last Name: Jones___________First Name: %_____________FILTERBUTTON
GridviewLast Name First NameBob JonesBill Jones
I have not found anything useful on the Wizard control. Anything I can find gets to the last step and then just takes the info you supplied and applies them to a bunch of Label.Text's - none that do work.
So I am building a Wizard control for an HR system that will insert the information into SQL through a SqlDataSource. The problem is, only the controls that are present in whichever step is currently selected in VWD will appear in the Command and Parameter Editor.
I tried to work around it by selecting the first step, then applying the controls in step 1 within the Parameter Editor, but when I go back to do step 2, it erases everything I just did for step 1.
How do I implement the Wizard with a SqlDataSource?
I have a gridview that is tied to a SQLDataSource control. As the gridview is filled some of the ASPX code calls some code in the code behind page. Where I am having trouble is that in one of these calls I need to some how pass the id filed ("LISTID")of the table for the SQL statement in the code behind page and I'm not sure how to do it.
The code behind function is always using the same id and I do not know how to change it. Below is all the code.
Here is the calling code in the ASPX page.
"DeleteBtn" Visible='<%# IsDeleteBtnVisible %>' runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" ForeColor="#003399"> Here is the entire ASPX code. class="header"> class="title">My Lists "Span1"> Current List Filter: "DropDownList2" cssclass="filterdropdown" AutoPostBack="true" runat="server"> "Active" Value="False"> "Done" Value="true"> --------------------------------------------------------------------------------"separator2"/> "list2"> "ScriptManager1" EnablePartialRendering="true" runat="server"> "Up2" UpdateMode="Conditional" runat="server"> "GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="LISTID" DataSourceID="SqlDataSource1" AllowPaging="True" AllowSorting="True" EnableViewState="False" GridLines="None" AlternatingRowStyle-BackColor="#FFFFCC" AlternatingRowStyle-Font-Size="Small" ForeColor="#FFFFCC" Font-Size="Small" AlternatingRowStyle-ForeColor="Black" Width="100%" HeaderStyle-ForeColor="White"> "False"> "LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="Update" ForeColor="#003399"> "LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" ForeColor="#003399"> "LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" ForeColor="#003399"> "DeleteBtn" Visible='<%# IsDeleteBtnVisible %>' runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" ForeColor="#003399"> "buttons"> "commands"> "ITEM_DETAILS" HeaderText="Details" SortExpression="ITEM_DETAILS" ControlStyle-ForeColor="#003399"> "name_edit"> "name"> "name"> "Pri" itemStyle-HorizontalAlign="Center" SortExpression="Priority" ControlStyle-ForeColor="#003399"> "DropDownList1" Width="75" SelectedValue='<%# Bind("Priority") %>' runat="server"> "High" Value="3"> "Medium" Value="2"> "Low" Value="1"> "pri" Text='<%# FormatPriority(Eval("Priority")) %>' runat="server"> "priority"> "#003399"> "priority"> "DUEDATE" itemStyle-HorizontalAlign="Center" HeaderText="Due Date" DataFormatString="{0:MM/dd/yyyy}" SortExpression="DUEDATE" >
"Center">
"COMPLETEDON" itemStyle-HorizontalAlign="Center" HeaderText="Completed On" DataFormatString="{0:MM/dd/yyyy}" SortExpression="COMPLETEDON" >
"Center">
"Done" itemStyle-HorizontalAlign="Center" SortExpression="IsComplete"> "CheckBox1" runat="server" Checked='<%# Bind("IsComplete") %>'> "iscomplete"> "iscomplete"> "Done" Text='<%# FormatDone(Eval("IsComplete")) %>' runat="server">
"Button2" runat="server" CommandName="Something" DataTextField="LISTID" DataTextFormatString="{0} active items" text='<%# Eval("LISTID") %>'> "Empty">No lists "White"> "#FFFFCC" Font-Size="Small" ForeColor="Black"> "Div1"> "Up3" UpdateMode="Conditional" runat="server"> Add New List: "AddItem2" cssclass="newitem" runat="server"> "Button1" runat="server" OnClick="AddListBtn_Click" Text="Add"> "txtdate" runat="server"> "Button1" EventName="Click"> "SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:FastTrackConnectionString %>" SelectCommand="SELECT * FROM [TODO]"> Here is the code behind page code. Protected Function IsDeleteBtnVisible() As Boolean ' Return IIf(itemCount = 0, True, False)
'This is for my gridview Dim strConn2 As SqlConnection = New SqlConnection Dim cmd2 As SqlCommand = New SqlCommand Dim rs2 As SqlDataReader Dim test1 As String Dim test2 As String
strConn2.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("FastTrackConnectionString2").ToString() strConn2.Open()
cmd2.Connection = strConn2 cmd2.CommandText = "SELECT LISTID, (SELECT COUNT(0) AS ItemCount FROM TODO_SUB_ITEMS WHERE(LISTID = TODO.LISTID) AND (ISCOMPLETE ='False')) AS ItemCount FROM TODO WHERE (ISCOMPLETE ='False')"
rs2 = cmd2.ExecuteReader()
rs2.Read()
Dim testlistid As Integer = rs2(0) Dim intholder As Integer = rs2(1)
strConn2.Close() cmd2 = Nothing strConn2 = Nothing
Return IIf(intholder = 0, True, False)
End Function
I have a gridview that is filled from a SQLDataSource control when the page loads.
I need to do some updates and delets on this data and I wanted to know can you add more than one SQL statement to a SQLDataSource control or do I have to have a seprate control for each operation?
The SQL currently is just the standard SELECT *, I cannnot see a way to add statments.
Thanks,
Ty
There is something I don't understand or I am just missing something here.
Why is it that I can place an SqlDataSource1.Insert() or update, or delete, but not an SqlDataSource.Select() inside a button click event "for an example" without getting an Compilation Error?
Thanks,
xyz789
I have dragged 3 SqlDataSource Controls to the WebDesigner and none are appearing graphically in the Designer View, but they are in the Source View. How can I get the control to appear in the designer.
Thanks,
Mark