Returning only the Header Row instead of all the relevant rows.


Hi All:

My below sub in application is returning only the Header Row instead of the relevant rows I guess therez problem in my "str" Syntax. However I fail to understand where exactly is it faultering. 

Private
Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click

Try

con.Open()

Dim empID As String = txtEmpID.Text

Dim FName As String = txtFName.Text

Dim LName As String = txtLName.Text

Dim str As String = "Select Emp_ID, Emp_FName,Emp_LName,Emp_Address1,Emp_HNo,Emp_MNo from Emp_Details where Emp_ID='" & empID & " ' Or Emp_LName='" & LName & " ' Or Emp_FName=' " & FName & "'"""Dim da1 As New SqlDataAdapter(str, con)

da1.Fill(ds, "Emp_Details")

dgEmp.DataSource = ds

dgEmp.DataMember = "Emp_Details"

dgEmp.DataBind()

Finally

con.Close()

End Try

End Sub

 

Thanks in Advance for your quick help.

 Regards,

Brandy

0
Brandy80
8/9/2007 12:42:49 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

2 Replies
637 Views

Similar Articles

[PageSpeed] 21

It looks like you might have one too many extra spaces in your statement. Try this instead: 

Dim str As String = String.Format("SELECT Emp_ID, Emp_FName, Emp_LName, Emp_Address1, Emp_HNo, Emp_MNo FROM Emp_Details WHERE Emp_ID = '{0}' OR Emp_LName = '{1}' OR Emp_FName = '{2}'", empID, LName, FName)

Thanks, Ed

Microsoft MVP - ASP/ASP.NET

0
ecbruck
8/9/2007 1:07:05 PM

This works... Appreciate your kind help.

0
Brandy80
8/10/2007 4:16:42 AM
Reply:

Similar Artilces:

adding a blank header row /row above the header row
is it possible to add a blank row above the header row in gridview for adding some links and buttons the links will respond to thae data in the grid and the buttons are for login / regisration etc....  if yes how it can be done or how do i achieve it. Its better that u create a table with a single row with columns matching the GridView columns. Set the table width same as the GridView width. This will make the GridView Look as if there is a row above its header.Please do not forget to click Mark As Answer on the post that helped you. Regards,Iam Srikanth Reddy....

Returning n rows, setting start row, total number of rows
Hi, I'm try to find out how ado.net can perform some of the things i am able to do in ado. Here is the scenario: I will be searching a table that may have 1000's of rows. I want to be able to dictate how many rows (page size) to return and what the starting row number is and be able to find out how many total rows would be returned by the query. Using old ado recordsets I was able to get the recordset and get the count or all the rows (.recordcount - ormaybe it was .rowcount) and then jump to the starting position (.absoluteposition). How can I do the equivalent in .net? From loo...

First Row, Next Row, Prior Row, Last Row
I have a SQL Anywhere 7.0 Database, have a table Product_detail which contains Column Name Datatype width Null Default batch_id char(10) No None prod_id Integer No None employee_id Integer No None quantity Integer No None price Numeric (14, 2) No None Its primary key is batch_id I have a Freeform Datawindow with this table I want to provide the first row, next row, prior row and last row Ho...

Header separator row each 7th row.
Hi, I have a nice gridview generated from a ObjectDataSource upon a generic list. The grid displays a long list of days with some different columns following. Before each date that is for instance a Monday, I would like to generat a row with a header, like Week 23, Week 24 and so on (fetched from the dates). I have noticed this event that i might be able to use: Protected Sub GridView_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs) But actually I have no idea how. I will need to test the date on each row creation and when it is a Monday i will have to somehow add a row...

SQL Data displayed row by row
Hi,  I was wondering if it was possible to get some help, what I am trying to do is create a ASP webpage that will display Data from an sql database row by row and if there is no data in one row then it will display a message saying "No Data in row"  Any help would be appreciated  Thanks, Michael   mstoten: I was wondering if it was possible to get some help, what I am trying to do is create a ASP webpage that will display Data from an sql database row by row and if there is no data in one row then it will display a message saying "No Data i...

How do I "row-wrap" ? i.e., have 2 rows of headers, and 2 rows in grid for each data record?
Hi I have built a view in Sql Server, and built my Sql Data Source, and everything looks good... I have my data grid populating nicely. But, I want the headers and rows to wrap - not inside each cell, but to fit the page. Let's say I have 10 columns, and only 5 will fit in the width of a webpage.  I would want the headers to wrap, so there are two rows of headers, then each data record would fill 2 rows in the grid. Example:  <headers> Last Name................First Name.............. Middle Name.............DOB............SSN............. <end of this row in grid>...

SQL returns no rows...
I have a sql statement which gives me the correct rowid when i substitute the values like this: string ls_rowid SELECT rowid into ls_rowid FROM W.t1 WHERE name='A' AND id='1' AND dept='SW' AND DateTime=(SELECT MAX(DateTime) FROM WAFERADI.ADI_RECIPE WHERE name='A' AND id='1' AND dept='SW') but when i put variables like this: SELECT rowid into ls_rowid FROM W.t1 WHERE name=:ls_a AND id=:ls_id AND dept=:ls_dept AND DateTime=(SELECT MAX(DateTime) FROM WAFERADI.ADI_RECIPE WHERE name=:ls_a AND id=:ls_id AND dept=:ls_dept) I get zer...

$sth->rows, doesn't return the correct number of rows return
------_=_NextPart_001_01C5518A.365E711F Content-Type: text/plain Hi Guys, When i do select quiery and then try to get count of rows like this in perl script from Oracle database and Informix: $rowCnt = $sth->rows; above line is being executed after the $sth->execute; This problem I am facing in Informix and Oracle both. Any suggestions or solution would be great help. Thanks Ravish ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of t...

foreach in DataTable.Rows returns deleted row?
What are the circumstances under which you will be returned a data row with a row state of "Deleted" when iterating the rows collection of a data table?I'm getting a DeletedRowInaccessibleException in my application.  However when I try to recreate the scenario in a test app the deleted row is skip in the foreach loop.What are the rules for this? -Thx  You should not get that! Did you made any modifications? What do you do previous to that? CheersAlMy BlogMapStats.NETPlease click on 'Mark as Answer' if this post answered your question! It's someth...

Is there a limit on rows returned from a cursor or rows in a dataset?
Hi, I am using c# and an oracle database.  I have a stored procedure that populates a datagrid.  The procedure returns a refcursor and then I get the dataset and populate the datagrid from the dataset.  When I run the procedure in SQL/Plus, it always returns the correct amount of rows, but whenever there are more than 120 rows, the datagrid no longer gets populated.  120 rows or less and it works exactly like it should.  I am wondering if there is alimit in the amount of rows that can be passed from a stored procedure to the C# via a cursor, or if there is...

single-row subquery returns more than one row
 I want a subquery  to return more than  one value then  use those values to get more values from  the other table. But  I  am receiving the errors saying ORA-01427: single-row subquery returns more than one row. How can I avoid this and achieve  want I want? My sql and Csharp is below:dbcon.Open();            string strreg = "SELECT Amount AS TotalAmount FROM Payment WHERE studentno=(SELECT tempcode FROM  specialstudent WHERE custid='"+ AreaNO +"')";    &...

Why does TableRowCollection.Rows return 0 row count...
After I dynamically create a table of rows...it seems that I cannot use the TableRowCollection to get a reference to the rows. Despite the Table tblAvailable clearly containing rows on the page...objRows.Rows returns 0...as though no rows exist for the table. I do this with GridViews quite often without issues...but had to use a Table in this case...any suggestions on what I might be doing wrong? ' Declared at the Class level...Protected WithEvents tblAvailable As New Table ' Within a function...Dim objRow As TableRowDim objRows As TableRowCollection = tblAvailable.Rows For Each objR...

How do i get one row if the resultset returned has no rows.
Hi I have couple of CTE's which i want to ultimately insert into a temp table... and based on my condition some of the CTE's return some rows and some dont... but i want to have the CTE return atleast one row if there is no data in it.. I have tried doing the following but i am not getting the desired output    ;with cte_rpt4 as (select '4' a,recd_dt as approve_dt, prov_no, prov_name, client_id, claim_mst_id, claim_adj_id, claim_dt, claim_amt, rpt4, (Select count(distinct(Claim_mst_Id)) as crpt4 from #temp1 where datediff(day,isnull(recd_dt,create_dt),isnull(c...

How do I display data from an sql query row by row?
I have the following code (at bottom of msg) in a page I'm trying to write. It works ok with a datagrid but I don't want a datagrid on the page as they look ugly (by default). Questions ... 1. Can I use a datagrid to display data with a custom layout? 2. How can I access data obtained from an sql server stored procedure row by row? I'm told you do it with a Dataset but I don't know how. The site is to look like this ... http://www.numbersix.co.nz/temp/intranet.jpg ... that's the existing site in ASP but must be converted to ASP.NET to keep up with things. Can anyone hel...

Web resources about - Returning only the Header Row instead of all the relevant rows. - asp.net.sql-datasource

Returning - Wikipedia, the free encyclopedia
In retail , returning is the process of a customer taking previously purchased merchandise back to the retailer, and in turn, receiving a cash ...

Mark Zuckerberg Returning To TechCrunch Disrupt
Facebook Co-Founder and CEO Mark Zuckerberg took the stage at last year’s TechCrunch Disrupt conference in San Francisco, where he discussed ...

How-to: Improve the Experience for Returning Users
... – your inbox, your favorite news sources, or your friends’ activity. If you’ve integrated Facebook Login on your website, you can give returning ...

Search Twitter - emilia-clarke-not-returning
Sign in Sign up No results for emilia-clarke-not-returning Settings Help Back to top · Turn images off

Is the Returning CEO a Trend?
... well be wondering if it is a new trend for boards to reach back into their alumni ranks to bring back a CEO when a company is in Is the Returning ...

Fire engine returning from a call
District of Columbia Fire & EMS Station No. 3

Zillow: Long Distance (Returning Soldier Commercial) - YouTube
Introducing Zillow's latest TV commercial as part of its national advertising campaign, "Find Your Way Home." The spot, entitled "Long Distance," ...

WWE’s Daniel Bryan on WWE 2K16, facing Brock Lesnar at WrestleMania, returning to the ring and life on ...
The four-time WWE world champion discusses whether it is right for Stone Cold Steve Austin to be the cover star of WWE 2K16, as well as who he ...

Damn Fine News of the Day: Kyle MacLachlan is Returning to ‘Twin Peaks’
In case you missed it, David Lynch announced on Twitter Monday that Kyle MacLachlan will reprise his role as Special Agent Dale Cooper in the ...

Returning Cat Daniel Menzel hopes for a pain-free summer
Having starred in his first match in almost four years, Geelong forward Daniel Menzel says his next major challenge is to train - pain free - ...

Resources last updated: 11/28/2015 10:49:08 AM