Select Just A Couple Of Rows Into Gridview
I am using a sqlDataSource to read my query and to put the rows into a gridview. Now I want to read just a couple of rows from my query based on a maximum number, also defined in the table. I have absolutely no idea how to do that..
for example: I want to view only the 10 most recent subsciptions into my gridview. The subscriptions are stored into tabel Subscriptions which has values id, userid,date. Table Event has a parameter "maximum subscriptions" (which is 10 in my example)
I hope it is clear enough?
Thank you in advance!
BlueiVeinz
View Complete Forum Thread with Replies
Related Forum Messages:
Do Not Include Certain Rows Into Gridview
I want to retrieve some data in my gridview using a sqldatasource. Here's the idea. My Gridview contains events. A user can subscribe into one of them. When he subscribes, the event must be removed in the gridview. So when there is a subscription from that certain user for that event, it may not appear. Here's my not working code..SELECT Event.EventID,Event.name, Event.LocationID, Event.Date, Event.StatusFROM Shift INNER JOIN Event ON Shift.EventID = Event.EventID INNER JOIN Subscription ON Shift.ShiftID = Subscription.ShiftIDWHERE (Subscription.UserID <> @UserID) Greetz
View Replies !
LinqDataSource && GridView: Update Fails (no Rows Affected)
Hi, Using VS.NET 2008 Beta2, and SQL Server 2005. I have a gridview bound to a linq data source, and when trying to update a row, I get an exception that no rows were modified. The query generated is: UPDATE [dbo].[package] SET [owner_id] = @p5 WHERE ([package_id] = @p0) AND ([title] = @p1) AND ([directory] = @p2) AND ([owner_id] = @p3) AND ([creation_date] = @p4) -- @p0: Input Int32 (Size = 0; Prec = 0; Scale = 0) [20006] -- @p1: Input String (Size = 22; Prec = 0; Scale = 0) [Visual Studio.NET 2005] -- @p2: Input String (Size = 26; Prec = 0; Scale = 0) [MSI_Visual_Studio.NET_2005] -- @p3: Input Int32 (Size = 0; Prec = 0; Scale = 0) [10000] -- @p4: Input DateTime (Size = 0; Prec = 0; Scale = 0) [11/07/2007 12:00:00 a.m.] -- @p5: Input Int32 (Size = 0; Prec = 0; Scale = 0) [10001] -- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.20706.1 If I run it manually on sql server, it fails until the directory column is removed. The type is varchar(50), with a uniqueness constraint. However, this is same type as the title column, which doesn't have this problem. Thanks, Jessica
View Replies !
Howto: Insert Multiple Rows Of Data From A Gridview Into A Sql Database
I have a gridview with rows of info which does not go into edit mode. A user clicks a checkbox which picks that item and adds a quantity which does some calculations. What i need to do is when a user clicks on a button, it should scan through the gridview for all items checked and pick up the quantity values and a couple of other field values and insert the information into a sql database What would be the best way of doing this? I tried the following example using a stored proc, but could not locate the proper reference or namespace for Database db = DatabaseFactory.CreateDatabase(); StringBuilder sb = new StringBuilder(); sb.Append("<absorbentitems>"); // Gets the selected rows in the gridview foreach (GridViewRow dvr in gvAbsorbents.Rows) { CheckBox checkbox = (CheckBox)dvr.FindControl("tbQty"); // Check to see if the CheckBox is checked or not if (checkbox.Checked) { // Make the string here sb.Append("<item code=""); sb.Append(((CheckBox)dvr.FindControl("lblItemCode")).Text); sb.Append("">"); sb.Append("</item>"); sb.Append("<itemordered qty=""); sb.Append(((CheckBox)dvr.FindControl("tbQty")).Text); sb.Append("">"); sb.Append("</itemordered>"); } } sb.Append("</absorbentitems>"); Database db = DatabaseFactory.CreateDatabase(); DBCommandWrapper insertCommandWrapper = db.GetStoredProcCommandWrapper("usp_InsertManyRows"); insertCommandWrapper.AddInParameter("@XMLDOC", DbType.String, sb.ToString()); try { db.ExecuteNonQuery(insertCommandWrapper); //Label1.Text = "Data Inserted"; } catch (Exception ex) { //Label1.Text = ex.Message; } Any way of making the above example work or any other better way of inserting multiple rows of data from a gridview into an sql database would be super. thanks!
View Replies !
Gridview Select
I am using a GridView which is select enabled. I have another sqldatasource control on my page which will run a SQL query but needs a parameter. This parameter is from a column (EmployeeID) of the selected row in the gridview. In the Sqldatasource control I have specified the parameter source as a control which is Gridview .But I dont know how to point to the EmployeeID column of the selected row.Please help.
View Replies !
Select Parameters With Gridview
I have a form that has 4 fields to fill in. I have a button that can add these fields to a sql database. I also want to put a button next to the "add" button so you can fill out the same fields and search for those values. Here's what i have so far. I want to select based on the fields, but i'm having trouble with the syntax of the parameters. I also want to add something, so if nothing is filled out in one of those boxes, it retuns back all records for the default value. string strConnection = ConfigurationManager.ConnectionStrings["TimeAccountingConnectionString"].ConnectionString; SqlConnection myConnection = new SqlConnection(strConnection); String selectCmd = "SELECT * FROM users WHERE firstname = @firstame or lastname = @lastname or office = @office or team = @team"; SqlDataAdapter myCommand = new SqlDataAdapter(selectCmd, myConnection); myCommand.SelectCommand.Parameters.Add(new SqlParameter("@firstname", SqlDbType.VarChar, 50)); myCommand.SelectCommand.Parameters.Add("@firstname", txtFirstName.Text); myCommand.Parameters.AddWithValue("@lastname", txtLastName.Text); myCommand.Parameters.AddWithValue("@team", dwnTeam.Text); myCommand.Parameters.AddWithValue("@office", dwnOffice.Text); DataSet ds = new DataSet(); myCommand.Fill(ds, "users"); MyDataGrid.DataSource = ds.Tables["users"].DefaultView; MyDataGrid.DataBind();
View Replies !
Changing The SQLDatasource SELECT For A Gridview
I cant seen to change the Select command for a SQL Datasourcetry #1 SqlDataSourceProfilesThatMatch.SelectCommand = strSQLForSearch SqlDataSourceProfilesThatMatch.SelectParameters("ProfileID").DefaultValue = pProfileID SqlDataSourceProfilesThatMatch.SelectParameters("LoggedInUsersZipcode").DefaultValue = pUsersZipCode SqlDataSourceProfilesThatMatch.SelectParameters("ZipDistance").DefaultValue = pDistance NewProfilesThatMatchGridView.DataBind() try #2 SqlDataSourceProfilesToBeMatched.SelectParameters.Clear() SqlDataSourceProfilesThatMatch.SelectCommand = strSQLForSearch SqlDataSourceProfilesThatMatch.SelectParameters.Add("ProfileID", pProfileID) SqlDataSourceProfilesThatMatch.SelectParameters.Add("LoggedInUsersZipcode", pUsersZipCode) SqlDataSourceProfilesThatMatch.SelectParameters.Add("ZipDistance", pDistance) NewProfilesThatMatchGridView.DataBind() No errors but no rows show in the gridview. If I debug and get the value strSQLForSearch and paste it into a new SQL query window I get results. Any ideas???? Thanks
View Replies !
Select Command Lost Thus Gridview Shows Nothing
Hi there,I am not sure how many of you have experienced this problem before but here is how to replicate it: Add a GridView, SqlDataSource and Button to a new projectSet the DataSourceID to the SqlDataSource objectSet AllowPaging to True on the GridViewWithin the Button1_Click sub, change the SqlDataSource.SelectCommand to a new Query e.g SELECT * FROM table WHERE ID > 1Run the project Click on another page, i.e. "3" on the GridView SqlDataSource.SelectCommand is now blank(!), thus Gridview displays nothing. Has anyone else found a solution to this annoying issue? Any help is appreciated.Regards
View Replies !
Need Gridview To Display Different Columns Based On New SELECT Statement
I have built an Advanced Search page which allows users to select which columns to return (via checkbox) and to enter search criteria for any of the selected columns (into textboxes). I build the SQL statement from the properties of the controls. Works great. My problem is getting my gridview control to play nicely. At first I used a SqlDataReader and bound the gridview to it, thus giving me the ability to run new SQL statements through it (with different columns each time). Worked nicely. But, per Microsoft, sorting can only be done if the gridview is bound to a datasource control like the SqlDataSource. So I wrote the code to handle sorting. No big deal; worked nicely. But I could not adjust the column widths programmatically unless bound to a datasource control like the SqlDataSource. And could not figure out a work around. So, I decided to use the SqlDataSource. Works great. Except, I cannot figure out how to run a new SELECT statement through the SQLDataSource and have the gridview respond accordingly. If I try to return anything other than the exact same columns defined declaratively in the html, it pukes. But I need to be able to return a new selection of columns each time. For example, first time through the user selects columns 1,2,3,4 – the gridview should show those 4 columns. The second time the user selects columns 2,5,7 – the gridview should those 3 columns (and ONLY those 3 columns). Plus support selection and sorting. I am desperate on this. I've burned 2.5 days researching and testing. Does anyone have any suggestions? Thanks, Brad
View Replies !
Sqldatasource, Does It Select If Not Bound To A Gridview, Formview On The Page?
Using 3.5 If I have a sqldatasource on the page, is it run if it is not bound to a data object like a gridview? Seems like if i want to access the data (like set a label text) from the sqldatasource I have to use code to first create a dataview then pick throught it. This seems like I'm running it twice. I'm new at .net so I dont know how to tell. I don't want to write data select code programatically when I can just through an SDS on the page, but wondered it it ran just because it's on the page.
View Replies !
Want Error Message To Appear When No Database Results Were Returned In GridView, Also Other GridView Issues.
Hi, I am seeking a hopefully easy solution to spit back an error message when a user receives no results from a SQL server db with no results. My code looks like this What is in bold is the relevant subroutine for this problem I'm having. Partial Class collegedb_Default Inherits System.Web.UI.Page Protected Sub submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles submit.Click SqlDataSource1.SelectCommand = "SELECT * FROM [college_db] WHERE [name] like '%" & textbox1.Text & "%'" SqlDataSource1.DataBind() If (SqlDataSource1 = System.DBNull) Then no_match.Text = "Your search returned no results, try looking manually." End If End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load SqlDataSource1.SelectCommand = "SELECT * FROM [college_db] ORDER BY [name]" SqlDataSource1.DataBind() End Sub Protected Sub reset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles reset.Click SqlDataSource1.SelectCommand = "SELECT * FROM [college_db] ORDER BY [name]" SqlDataSource1.DataBind() End SubEnd Class I'm probably doing this completely wrong, I'm a .net newb. Any help would be appreciated. Basically I have GridView spitting out info from a db upon Page Load, but i also have a search bar above that. The search function works, but when it returns nothing, I want an error message to be displayed. I have a label setup called "no_match" but I'm getting compiler errors. Also, next to the submit button, I also have another button (Protected sub reset) that I was hoping to be able to return all results back on the page, similar to if a user is just loading the page fresh. I'd think that my logic would be OK, by just repeating the source code from page_load, but that doens't work.The button just does nothing. One final question, unrelated. After I set this default.aspx page up, sorting by number on the bottom of gridview, ie. 1,2,3,4, etc, worked fine. But now that paging feature, as long with the sorting headers, don't work! I do notice on the status bar in the browser, that I receive an error that says, "error on page...and it referers to javascript:_doPostBack('GridView1, etc etc)...I have no clue why this happened. Any help would be appreciated, thanks!
View Replies !
GridView Based On SQLServerDataSource Using A Select Union Statement, Impacts On Update And Insert?
I have a GridView dispalying from a SQLServerDataSource that is using a SQL Select Union statement (like the following): SELECT FirstName, LastNameFROM MasterUNION ALLSELECT FirstName, LastNameFROM CustomORDER BY LastName, FirstName I am wondering how to create Update and Insert statements for this SQLServerDataSource since the select is actually driving from two different tables (Master and Custom). Any ideas if or how this can be done? Specifically, I want the Custom table to be editable, but not the Master table. Any examples or ideas would be very much appreciated! Thanks, Randy
View Replies !
Select Distinct Rows From Duplicate Rows....
Dear Gurus,I have table with following entriesTable name = CustomerName Weight------------ -----------Sanjeev 85Sanjeev 75Rajeev 80Rajeev 45Sandy 35Sandy 30Harry 15Harry 45I need a output as followName Weight------------ -----------Sanjeev 85Rajeev 80Sandy 30Harry 45ORName Weight------------ -----------Sanjeev 75Rajeev 45Sandy 35Harry 15i.e. only distinct Name should display with only one value of Weight.I tried with 'group by' on Name column but it shows me all rows.Could anyone help me for above.Thanking in Advance.RegardsSanjeevJoin Bytes!
View Replies !
SELECT * Not Returning Any Rows, But SELECT COL_NAME Does!
I have a table which is returning inconsistent results when I queryit!In query analyzer:If I do "SELECT * FROM TABLE_NAME" I get no rows returned.If I do "SELECT COL1, COL2 FROM TABLE_NAME" I get 4 rows returned.In Enterprise manager:If I do "return all rows" I get 4 rows returned, and the SQL is listedas being "SELECT * FROM dbo.TABLE_NAME".I've tried adding the "dbo." before my table name in QA, but it seemsto make no difference.I'm using SQL Server 2000, which is apparently 8.00534.Can anyone help me, or give me ideas about what to check?Thanks,Rowland.
View Replies !
Couple Of Questions
Feel free to point me to relevant articles... 1) Preinit phase sometimes takes too long. Any way to workaround this? What can I do to prevent something like this? 2) I have a requirement that no temp files/data can be on drive C:. Does any tasks do something like this and how to avoid it? 3) Dont want to inherite ErrorHandler to all childobjects. How? 4) What is the buffer impact on Merge-Joins? 5) It seems theres and issue with slow start of packages and dev environment under 64Bit? Any info on this? 6) Can I use deployed package to edit it in studio? MC
View Replies !
Couple Of Question About SQL 2000
Hi I've bin using MySQL and now trying to convert it on to SQL 2000 and i've got a couple of questions 1. Ive got a SQL Script of a database generated by MySQL, can i run this script stright into SQL 2000 and if so how do i go about it ???? 2. In my MySQL i have a Gender field which data type is Enum ('M','F'). How do i recreate this type of field in SQL 2000. Thanks
View Replies !
A Couple Of Easy Questions
Hi everyone, Running Windows 2003 x64 and Sql25k 64-bit edition We just have a couple of questions related with our system: -What is Sql Server VSS Writer service for? -What sort of implications must we assume when Integration Services service is running as NT AUTHORITYNetworkService Any link or advice would be welcomed. Thanks for your time,
View Replies !
A Couple Of Easy Questions
Hi everyone, Our application throws on-demand SSIS packages stored on remote server by means of threads, throwing more than one at the same time. I would like to understand properly how all the objects work between them (better late than never, of course) In the vb project there are defined three assemblies: DtsRunTimeWrap.dll, DtsPipelineWrap.dll, and ManagedDts.dll. Microsoft.SqlServer.Dts.Runtime belongs to ManagedDts.dll Microsoft.SqlServer.Dts.Runtime.Wrapper belongs to DtsRunTimeWrap.dll Microsoft.SqlServer.Dts.Pipeline.Wrapper to DtsPipelineWrap.dll According BOL ..Pipeline namespace contains managed classes that are used to develop managed data flow components. My application only loading and executing DTSX files so this way I don't need at all this reference. I'll drop it. So when I create a Scrip Task in my Control Flow it needs a ManagedDTS.dll and when I create a Script Component in my Data Flow it needs both Pipeline.Wrapper (DtsRuntimeWrap.dll) and Runtime.Wrapper (DtsPipelineWrap.dll) namespaces. Is it correct? Ok, the second question is why appears in my Project explorer this reference: Interop.DTSLib.dll Curiously it's stored in my bindebug path of my own project. ?¿ "InterOp.DtsLib.dll" Where does it come from? I'm a little bit confused. Is it a PIA for the ManagedDTS.dll? If so, why on earth is there keeping in mind that I am only managing SSIS packages (managed code) no Sql2k-dts (unmanaged code)??? Or it is compulsory keeping in mind that some packages calling COM objects from the Control Flow??? Thanks a lot for your comments
View Replies !
A Couple Of Things With My New Report
I have made a report in SRS and am not sure of how to do some of the functions I need. In SQL I can use UPPER to convert to upper case, SRS doesn't seem to like this. The report runs but the line that is to be upper case is missing. If I remove the UPPER word from my query it works fine just displaying in lower case. Am I doing something wrong? In Excel 2007 (I am converting my report from Excel to SRS) there is a function called NETWORKDAYS (Returns the number of whole working days between start_date and end_date. Working days exclude weekends and any dates identified in holidays. Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term.) Is there something similar I can use in SRS? Thanks.
View Replies !
Just A Couple Quick Questions
I need to: Copy an existing production database to a new database on the same server; this will be used for development. Copy an existing table for backup purposes in preparation for deleting a couple fields from the table (precautionary process really). I've been out of the database swing if you will for a while, just now getting the opportunity to get my feet wet so to speak. I can use either Enterprise Manager or connec to the database via ODBC and make the copies/deletes there, but I'm looking to do this via EM or SQL command. Any help or direction would be greatly appreciated! Thanks! Bobby
View Replies !
A Couple Of SQL Server Express Questions
Hello - I'm about to rebuild my website on a nice new windows 2k3 server. I was previously using SQL server 7 but I'd like to use the 2005 edition. Here's my first question - is the Express edition 2005 good enough to use on my live web server? Are there limits on the amount of connections at any one time? My second question is this - what's the best way to connect to SQL Server 2005 Express? At the moment I would use something like: Server=.SQLEXPRESS;Integrated Security=True;Database=myDB And then I would set up a COMPUTERNAMEASPNET account under SQL Server 2005 Express. Is that an ok way to connect?? Any ideas? Thanks.
View Replies !
A Couple Beginning Questions MSDEvsSQL
I am not a full time database admin but I am familliar with sql server 2000. I am comfortable using Enterprise Manager for managing backups and replication. Thats basically what I do with it since I am not really a developer but an admin. I do however like to program and I am learning asp.net/ado.net. I have only done one very small project in Access as a little experment. Now, I'm going over the reports starter kit which required me to install MSDE 2000. Needless to say, I feel very in the dark without Enterprise Manager. Now moving forward with my asp.net/ado.net education.... 1) Aside from the bandwidth throttling that MSDE does is it's purpose to actually use with production apps? Or is it just supposed to be for development stages of a project since its free and an app built on it can easily scale to the full fledged sql server version? 2) is the TSQL language used with sql server 2000 the exact same as that of MSDE 2000? 3) I assume db size and concurrent users are the biggest deciding factor for the decision between MSDE and sql server, correct? (this is assuming MSDE really is to be used for production apps... I was looking for verification on that in my first question) The next thing I want to start working on would be for under 50 users, probably no more than 25 concurrent users, and the data should not grow beyond MSDE's db size limitation... I am looking for guidance as to whether I should use MSDE or not? This question is posed based soley on the size and users.... not cost. I know sql server is expensive and msde is free. I already have an SQL Server at my disposal but I don't want to use it for this if MSDE will handle this particular job. any info is appreciated. Thanks.
View Replies !
Couple Of Easy Questions, Newbie Here
I am using Merge Replication for my scenario (POS). I have made the publication (articles are a set of tables in DB ABC) and its subscription (in same DB and diff tables xyz1, xyz2). I have scheduled the push subscription as run continuously between Dates(e.g current date to 3 days ahead, just for testing). Now, Can I change this schedule? How can I edit/remove the artilce from the above publication?
View Replies !
A Couple Of Quesitons Regarding SQL 2005 Express
Hello, I'm a little confused after installing a service pack for SQL 2005 Express. I see SP 1 & 2 for 2005 but I can't see where the SP stands alone for Express. The title says Express 2005 Service Pack 2. Does that mean that I download that version of Express and SP2 is already built in and I just load the new one over the old one or do I uninstall the old one first? I'm not real bold at this point since it took me a long time to get the Express working. Another question - I downloaded the DTSWizard.exe 2006 msi package and installed it on my XP Pro machine. The add/remove programs window shows it to be installed but it doesn't show up in the folder it is supposed too. I've done searches for the DTSWizard.exe but it's not there, anywhere. Any ideas what I may be doing wrong? I was able to get the DTSWizard to work on my 2000 Pro machine before going to XP Pro this past week. Thanks for any help you may be able to give me. Riley
View Replies !
Need Help Mixing A Couple Of Queries Into One Quer
I want to create a filtered view according to some information provides. for example I want to create in form 2 check boxes male and female and when either both or one of them is unchecked, the query filters out the unchecked content from view according to the other filtering conditions. the exact thing I need is: a text box for string looking (in a specific column). male & female checkboxes. two datetime textboxes to specify a range to focus in. it is very important to me, so if you misunderstood my question, please contact me.
View Replies !
Couple Of Basic SSIS Questions
Hello all, this is my first post, I have a couple of basic questions regarding the use of SSIS. I have used SSIS for a couple of years for on off table loads but never implemented production jobs with it so please bear with these questions. 1. When making scripts that connect to one or more databases, is there a way to store the userid and password somewhere besides embedded within the package, such as a web.config file, this would make routine password changes much more manageble. I guess it was only one question but any help would be greatly appreciated. Thanks.
View Replies !
Reporting Services - A Couple General Questions
A couple questions about SQL Server Reporting Services: 1. Can it be used for other data sources besides SQL Server (Oracle db, XML files, via APIs, etc.)? 2. Can it do ad hoc reporting? I like the "universes" that the SAP Business Objects product allows. Does Reporting Services have something like this, to provide a simplified view that non-technical business users can use to create their own reports? Or is Reporting Services just the equivalent to Crystal Reports? (I wanted to post this in the general MSDN forum for SQL Server, but I can never log in there for some reason.)
View Replies !
Couple Of Questions Regarding Building Packages Programatically
Hi, I'm trying to build a package programatically. I've added a variable to my package but how do you specify its datatype? Is it purely determined by the type of the value that you pass in the Variables.Add(...) method? I've added task and a sequence container to my package - no problem there. My sequence container is referenced in a variable of type DTSContainer but DTSContainer doesn't have an executables collection. So, how do I add a task into my sequence container? Thanks Jamie
View Replies !
Can't Connect To DB When SqlServer Exp Has Been Idle For A Couple Hours.
Does SQLServer go to sleep when it's been idle? How can I connect without an error? I have SQLExpress on a server. Server Name is SqlExpress. I have 2 DBs on that server... Tuna & Guppy. I'm connecting to the DBs from a remote PC which runs my App... an exe created with Visual Studio 2008, Visual Basic. If I run my App at say 9:30PM, after the server has been idle for several hours, I get a "Can't open connection to Guppy" error, which is my error message when the connection attempt fails. If I quit & relaunch the app, it connects fine, and will continue connecting fine unless you leave the server idle for serveral hours again. If I'm developing a 2nd app all evening... which connects to a 2nd DB...Tuna, that activity seems to keep the SqlServer awake and then launching the 1st app at 9:30PM connects to Guppy just fine. I tried adding a "Connection Timeout=30" to my connection string but that did not help. My connection code is as follows (note the server's name is SQLExpress): Dim strConnG As String = "Data Source=SQLEXPRESSSQLEXPRESS;Initial Catalog=Guppy;Integrated Security=True;Connection Timeout=30" Using ConnG As New SqlConnection(strConnG) 'open Guppy connection Try ConnG.Open() Catch ex As Exception MsgBox("Can't open connection to guppy") Return False End Try 'Code that does stuff End using Can anyone tell me how to fix this so I can connect without error, even if the server has been idle? Thank you, Joe A
View Replies !
A Couple Of, I Hope Basic Questions RE SqlDataSource's And Scripting
Greetings! I am writing a proof of concept ASP.net application for my employer and I have run into a couple perplexing issues. First off, In my Page_Load event I have the following code. txOTHrs.Attributes["onBlur"] = "return calculateTotal(this)"; The onblur event handler is coded as follows function calculateTotal(tb) { var regHrs = document.getElementById ("txRegHrs").value; var otHrs = document.getElementById("txOtHrs").value; var rate = document.getElementById("txRate").value; var regAmt = rate * regHrs; var otAmt= rate * ( otHrs * 1.5 ); var total = otAmt + regAmt; document.getElementById("txTotal").value = total; } Everything seems to work fine. The onBlur event is handled and, as I expect the value in the txTotal text box is updated correctly. The problem occurs when I try to access that value in the codebehind page. When ever I look at txTotal.Text in the debugger it is always blank. This has left me scratching my head as I can clearly see a value on the web page. Have I missed some step where I have to notify the server that a value in the control has changed ? My second question is, I hope a very easy one to answer. In WinForms when I have a dataset I can access the individual rows ( in an untyped dataset ) by speficying dataset.tables["tableName"].Rows[index]. Is there any similar mechanism for accessing the individual rows, and fields in the SqlDataSource object in ASP.net ? Any help anyone can provide is greatly appreciated!!
View Replies !
A Couple Of Questions On Remote Connection To SQL Server 2005 Database
I have a SQL Server 2005 database (called BDHSE) in a PC which i call PC1. I have a second PC (PC2) and both are within a network (a WLAN). What i want is to have access to BDHSE from an application in VB6 (APP1) running in PC2. All the INSERT, DELETE, UPDATE records process is done through APP1. APP1 ia currently running in PC1 and is to be installed on PC2. I have these questions: 1. What do i need to install in PC2 since all the INSERT, DELETE, and UPDATE is done using APP1? I guess i only have to install the Microsoft SQL Native Client (with all the prerequisites of course) but i am not sure. 2. In the APP1 made in VB6, do i have to change the connectionstring since i am accesing the database which physically is at PC1 and the APP1 will be used in PC2? 3. Any advice you can give me on doing this will be well received. Thanks in advance, BSc Fernando Martinez
View Replies !
Select Rows By One For Each Value
Tell me please how to select from a table only rows with different value of one of fields (n_pr field). But I need also to select some other fields where the values can be different for one n_pr field's value and select only first value of them. For getting list of n_pr field's values I can use derived table of query with DISTINCT operator but I don't know how to join with other fields of the table to get only one row for each value of joinning field n_pr. I am using SQL Server 2000 and this DBMS can use TOP operator to select only one row but all the ways I've tryed affect all the query and I get one row at all instead of one for each n_pr field's value. Also I need in this query to connect one more table. So for efficiency it better to do it in one query or in one stored procedure that return a recodset as it needs.
View Replies !
Select Rows With Like
Is it possible to write a stored procedure to select records that start with a passed string without using dynamic sql. E.g. SELECT EmpName FROM Employee WHERE EmpName LIKE 'John%' How does write the above query as a stored procedure (not dynamic sql). The 'John' should be received as argument to the procedure.
View Replies !
Select Last 20 Rows
I am very new to db and sql. I have a populated table and would like to run a query that brings up the last 20 rows. Here is what I have now...do I need a WHERE statement? SELECT d.cache_diff AS $<scachediff>, d.cache_name AS $<scachename>, d.cache_type AS $<scachetype>, d.cache_last_found AS $<cachelastfound>, d.cache_id AS $<cache_view_link>, d.cache_id AS $<log_find_link> FROM geocaches d
View Replies !
Select 2 Or More Rows With Same Id But..
I want to select rows that have been amended or deleted and want to use the amend date as the condition.all amended rows have a flag of 1 and deleted ones have a flag of 2 i.e select * from table where log_changed > '2008-06-23' and log_changed < '2008-06-24' will display all the rows that were amanded on the 2008-6-23 and with a flag of 1 or 2 but i also want the query to return the original row that was amended and has a flag of 0.the original row has a null log_changed field. the rows that must be returned must be the ones amended or deleted ones on a specific date but with the original ones as well. any ideas please In god we trust,everything else we test.
View Replies !
Select Rows Where Row Count &> 3
I have a view that I want to find all the rows that have a matching itemid and have more than 3 rows in them and group them by the itemid. I am not quite sure how to do this. Any ideas? ~mike~
View Replies !
Select Distinct For Different Rows
I have the following tablecolumns: [col1], [col2],[col3] and [NAME].I want to select the name column for each row where [col1]='07'.The problem is that there are several rows where [col1] contains '07' and also the name is the same. [col2] and [col3] contain different data for these double rows...however, I cant use the [col1] and [col2] values in my query because I dont know what values they contain beforehand.So now, when I execute my query and add the DISTINCT key I still get all the double rows!I hope this explains my problem, help is really appreciated...ow, btw: deleting the double rows is not an option....
View Replies !
Select Distinct Rows
Hi, I'm having a little bit of trouble trying to figure out how to do this query, right now I have: SELECT I.AppItemId, P.ProductID, P.PartNum, P.Relist, I.AppUserId FROM ProductsToRelist I join Products P on P.ProductID = I.AppSKU WHERE P.Relist = 1 and I.AppStatus = 5 and Not I.AppItemId is Null and it returns something like this: AppItemId ProductID PartNum Relist AppUserId 2786 -32730 SELECT_OOS11 2787 -32729 SELECT12 2788 -32727 SELECT_OOS11 4269 -30987 SELECT_OOS12 1665 -30987 SELECT_OOS11 2433 -30987 SELECT_OOS11 4272 -30984 SELECT11 2436 -30984 SELECT11 2793 -32708 SELECT11 But I only it want it to return 1 record for each ProductID like so: AppItemId ProductID PartNum Relist AppUserId 2786 -32730 SELECT_OOS11 2787 -32729 SELECT12 2788 -32727 SELECT_OOS11 4269 -30987 SELECT_OOS12 4272 -30984 SELECT11 2793 -32708 SELECT11 ProductID is the primary key for the Products table, and a product can be in the ProductsToRelist table many times but each row would have a unique AppItemId. I know that I need to use Distinct or a different kind of join, but I'm not sure which. How would you suggest to do this? Thanks
View Replies !
Select First N Rows Of Table
Let us say that I have a table with two sets of values as such:Item Extension--- ----100023 1100025 1100025 2100028 1100029 1100029 2100029 3[...]Note that a given item number can appear multiple times if it has morethan one extension number.I want to be able to select the first N entries as grouped by itemnumber. So if N = 3, that would return 100023, 100025 and 10028 withtheir associated extentions. I would also like to be able to selectsay, the 2nd through 9th entries grouped by item number.I've tried something like this to give me row counts:select rank = count(1), t1.item, t1.extensionfrom ItemTable t1 inner join itemTable t2on t1.item >= t2.itemgroup by t1.item, t1.extensionorder by rankBut that gives me this sort of result:Rank Item Extension---- --- ----1 100023 13 100025 13 100025 24 100028 17 100029 17 100029 27 100029 3[...]Any suggestions would be welcome.
View Replies !
How To Select Max Amount Rows
please help to select these rows from these tables my tables aretable1table1Id groupId table2id price1 1 1 102 1 3 10003 1 4 5004 2 1 55 2 3 10006 2 2 2000table2table2id name1 hello2 test3 test14 test2ok i want to select maximum priced row from table1 grouped by groupidwith table2id and table2.namemy out put isgroupid price table2id table2.name1 1000 3 test12 2000 2 testif i do :select groupid,max(table1.price) as price from table1 group by pricethis will give me the max priced row from table1but when i join them with the table2 it gives me all rowslikeSelect groupid,max(price) as price,table2id,table2.name from table1inner join on table2group by groupid,table2id,table2.nameit gives me all rows cause i had to group by table2.id and table2.namebut i can't take it out cause it give me no aggrigated value errori can't figure out any other way, please helpSQL Server 2000thankseric
View Replies !
Adding Some Rows To A Select
Hi folks,I've a sql query problem I was wondering if you all had a quick anddirty solution for. I've a query:Select code, value from table_a where date in(2004) and a_code in ('1000','2000') and b_code in ('01000','02000')This returns a table that looks like:A_CODE B_CODE VALUE------ ------ -----1000 01000 $5001000 02000 $750What I'd like to see is:A_CODE B_CODE VALUE------ ------ -----1000 01000 $5001000 02000 $7502000 01000 $02000 02000 $0Any suggestions on how to rewrite my query so the results show A_CODE2000 with a VALUE of 0 or null?Thank much in advance!Marc
View Replies !
How To Select Specific Rows..
Hi Friends... I have one table , suppose TableA which contains following columns.. I want to select records from this table where time difference is more than 2 min. (tec_insert_date) This means first record time and second one, then second one and third one..and so on.. How to select these records...pls give me some sql query... thanks in advance tec_number tec_insert_date tec_description ----------- ------------------------------------------------------ --------113909 2005-12-19 18:59:01.920 Description 113910 2005-12-19 18:59:02.043 Description 113911 2005-12-19 18:59:02.060 Description 113912 2005-12-19 18:59:02.060 Description 113913 2005-12-19 18:59:02.090 Description 113914 2005-12-19 18:59:02.090 Description 113915 2005-12-19 18:59:02.263 Description 113916 2005-12-19 18:59:02.437 Description 113917 2005-12-19 19:00:34.703 Description 113918 2005-12-19 19:00:34.720 Description 113919 2005-12-19 19:00:34.937 Description 113920 2005-12-19 19:00:35.607 Description 113921 2005-12-19 19:00:35.607 Description 113922 2005-12-19 19:00:35.840 Description 113923 2005-12-19 19:00:35.903 Description 113924 2005-12-19 19:00:36.200 Description 113925 2005-12-19 19:00:36.200 Description 113926 2005-12-19 19:00:36.217 Description 113927 2005-12-19 19:00:36.217 Description 113928 2005-12-19 19:00:36.217 Description 113929 2005-12-19 19:00:36.230 Description 113930 2005-12-19 19:00:36.230 Description 113931 2005-12-19 19:00:36.230 Description 113932 2005-12-19 19:00:36.230 Description 113933 2005-12-19 19:00:36.323 Description 113934 2005-12-19 19:00:36.450 Description 113935 2005-12-19 19:00:38.863 Description 113936 2005-12-19 19:00:38.943 Description 113937 2005-12-19 19:00:38.943 Description 113938 2005-12-19 19:00:39.100 Description 113939 2005-12-19 19:00:39.147 Description 113940 2005-12-19 19:00:39.300 Description 113941 2005-12-19 19:00:40.920 Description 113942 2005-12-19 19:01:23.363 Description 113943 2005-12-19 19:03:03.533 Description 113944 2005-12-19 19:03:08.197 Description 113945 2005-12-19 19:03:12.853 Description 113946 2005-12-19 19:03:14.087 Description 113947 2005-12-19 19:04:40.730 Description 113948 2005-12-19 19:04:44.843 Description 113949 2005-12-19 19:04:51.030 Description 113950 2005-12-19 19:04:56.313 Description 113951 2005-12-19 19:04:58.950 Description 113952 2005-12-19 19:09:19.950 Description 113953 2005-12-19 19:09:21.277 Description 113954 2005-12-19 19:09:21.340 Description 113955 2005-12-19 19:09:24.397 Description 113956 2005-12-19 19:09:35.660 Description 113957 2005-12-19 19:09:46.480 Description 113958 2005-12-19 19:09:47.790 Description 113959 2005-12-19 19:10:23.713 Description 113960 2005-12-19 19:10:23.980 Description 113961 2005-12-19 19:11:02.307 Description 113962 2005-12-19 19:11:52.040 Description 113963 2005-12-19 19:12:31.800 Description 113964 2005-12-19 19:12:31.940 Description 113965 2005-12-19 19:12:31.940 Description 113966 2005-12-19 19:13:10.500 Description 113967 2005-12-19 19:13:10.500 Description 113968 2005-12-19 19:13:50.697 Description 113969 2005-12-19 19:13:50.697 Description 113970 2005-12-19 19:13:50.743 Description 113971 2005-12-19 19:13:50.870 Description 113972 2005-12-19 19:13:50.883 Description 113973 2005-12-19 19:14:09.290 Description 113974 2005-12-19 19:14:47.680 Description 113975 2005-12-19 19:14:47.693 Description 113976 2005-12-19 19:14:48.630 Description 113977 2005-12-19 19:14:48.630 Description 113978 2005-12-19 19:14:49.127 Description 113979 2005-12-19 19:14:49.127 Description 113980 2005-12-19 19:14:49.160 Description 113981 2005-12-19 19:14:49.300 Description 113982 2005-12-19 19:14:49.313 Description 113983 2005-12-19 19:15:07.287 Description 113984 2005-12-19 19:15:07.783 Description 113985 2005-12-19 19:21:43.093 Description 113986 2005-12-19 19:22:01.920 Description 113987 2005-12-19 19:22:01.920 Description 113988 2005-12-19 19:22:20.780 Description 113989 2005-12-19 19:22:38.547 Description 113990 2005-12-19 19:22:38.547 Description 113991 2005-12-19 19:22:39.340 Description 113992 2005-12-19 19:22:39.340 Description 113993 2005-12-19 19:22:40.263 Description 113994 2005-12-19 19:22:41.010 Description 113995 2005-12-19 19:22:41.867 Description
View Replies !
Select Duplicate Rows
I get a tabseparated textfile with data every friday. Faulty rows are to be returned to the source. Double rows are considered a fault. How do I select all double rows? I join the data later on with four columns so if these columns are alike the rows are considered identical even if other columns are not. Ie: A, B, C, D, 12, 34, 48, 76 A, B, C, D, 23, 45, 56, 99 These two rows are considered alike since I join on A+B+C+D. I'd like to select ALL double rows and insert them into a separate table that I can return to the source. Does anyone have an idea how to do this?
View Replies !
How Can I Select Only Entries With At Least 2 Rows?
heyas, i wanna know how can i select only entries with at least 2 rows? What i mean is that i want to make a select * from table1 where columnA = 'Something' order by columnB but addicionally i want it to return only register that happen at least 2 times for columnB thanks in advance!
View Replies !
Select Rows For ETL Processing
I'm new to ssis (in case that isn't obvious!) I want to set up a package to automate a transfer of data from a relational database to a datawarehouse. I would like to transfer rows daily, but I only want to transfer those which have not previously been transferred. How/where do I tell the package/data flow task/ whatever to just transfer the daily differential from the last time it ran? Thanks
View Replies !
|