473,385 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Using SQLDataSource in GridView

44
Hi

I connected SQLDataSource in GridView by using coding
Expand|Select|Wrap|Line Numbers
  1. <asp:GridView ID="Search_GridView" runat="server" Style="z-index: 100; left: 2px; position: absolute;
  2.             top: 270px" AutoGenerateColumns="False" OnSelectedIndexChanged="Search_GridView_SelectedIndexChanged" CellPadding="20" Width="720px" AllowPaging="True" OnPageIndexChanging="Search_GridView_PageIndexChanging" DataSourceID="SqlDataSource1">
  3.  
  4.              <Columns>
  5.                     <asp:hyperlinkfield headertext="Doctors Name"
  6.       datatextfield="DoctorsName"
  7.       datanavigateurlfields="DoctorsName" 
  8.       datanavigateurlformatstring="Logging.aspx?DoctorsName={0}" />
  9.  
  10.  
  11.                          <asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />
  12.                          <%--<asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
  13.                           <asp:BoundField DataField="PrimaryTitle" HeaderText="PrimaryTitle" SortExpression="PrimaryTitle" />
  14.                  <asp:HyperLinkField Text="Fix an Appointment" HeaderText="Appointment Fixing" NavigateUrl="~/Appointment.aspx"/>
  15.                           --%>
  16.  
  17.  
  18.  
  19.                     </Columns>
  20.  
  21.  
  22.  
  23.             <HeaderStyle BackColor="InactiveCaption" BorderWidth="0px" />
  24.             <AlternatingRowStyle BackColor="Silver" />
  25.  
  26.  
  27.  
  28.  
  29.         </asp:GridView>
  30.         <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Hello_DrConnectionString6 %>" <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Hello_DrConnectionString6 %>" SelectCommand="SELECT [DoctorMaster].[FirstName]+''+[DoctorMaster].[MiddleName]+''+[DoctorMaster].[LastName] as DoctorsName, [DrClinicDetails].[Address], [DoctorMaster].[Telephone]+','+[DoctorMaster].[Mobile] as Phone, [PrimaryTitle].[PrimaryTitle] FROM [DoctorMaster], [DrClinicDetails], [PrimaryTitle], [Specialty] WHERE (([DoctorMaster].[FirstName] = @FirstName) OR ([Specialty].[Specialty] = @Specialty) OR ([DoctorMaster].[City] = @City) AND ([DoctorMaster].[DRID]=[DrClinicDetails].[DRID]) AND ([DoctorMaster].[SPID]=[Specialty].[SPID]) AND ([PrimaryTitle].[PTID]=[DoctorMaster].[PrimaryTitleID]))">
  31.  
  32.  
  33.  
  34.  
  35.  
  36.             <SelectParameters>
  37.                 <asp:ControlParameter ControlID="Label1" Name="FirstName" PropertyName="Text" Type="String" />
  38.                 <asp:ControlParameter ControlID="Label2" Name="Specialty" PropertyName="Text" Type="String" />
  39.                 <asp:ControlParameter ControlID="Label3" Name="City" PropertyName="Text" Type="String" />
  40.             </SelectParameters>
  41.         </asp:SqlDataSource>
  42.  
but the gridview is not getting display while running. I am sure the error is in query. Does SQLDataSource supports join.
Jul 1 '08 #1
1 1152
Curtis Rutland
3,256 Expert 2GB
As a full member now, you should know that we expect your code to be posted in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use the tags in future.

MODERATOR.
Jul 1 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: P | last post by:
Hello, I am having a difficult time updating a record via a stored procedure using the gridview and sqldatasource. I cannot seem to be able to find a way to set everything up so that I can pass...
8
by: Mike Kelly | last post by:
I've chosen to implement the "optimistic concurrency" model in my application. To assist in that, I've added a ROWVERSION (TIMESTAMP) column to my main tables. I read the value of the column in my...
3
by: sck10 | last post by:
Hello, I am creating a form for users to enter information about a lab and the members of the lab. I have one form (FormView) that they use to enter information about that lab. The keyvalue is...
3
by: Jim Andersen | last post by:
Hi, I would appreciate if someone could explain this behaviour, and maybe offer a better solution. I have been working with the GridView control. And SqlDataSource. It works great if I do:...
0
by: LiamLiamLiam | last post by:
G'day all. I having a problem with my formview. I'll ty to explain my situation as best as i can. I have a page with a search field at the top which is just a simple asp:textbox. Below that i...
1
by: Vili | last post by:
Hi all I would like to get some ideas and opinions of my solution for dataconnection on asp.net 2.0 I have created a class which encapsulates the sqldatasource usage. With my class one can...
1
by: sheenaa | last post by:
Hello Members, I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005. What i have used on forms :: ? On my first form i have used some...
7
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM",...
0
by: lamolap | last post by:
i have 1 gridview , a dropdownlist inside a gridview and a commandfield of (edit, update and cancel) my gidview looks like this Edit Surname Initials ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.