Solved

Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.SqlDataSource'

Posted on 2008-10-20
5
945 Views
Last Modified: 2012-05-05
I am trying to create a lookup with a drop down list box and I keep getting this error.  When I build the app it builds with no errors.  When I run the app I get this error message.  Can someone clue me in?


Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0029: Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.SqlDataSource'

Source Error:

 

Line 1:  <%@ Page Language="C#" MasterPageFile="~/TableMaintenance.Master" AutoEventWireup="true" CodeBehind="AddFedReg.aspx.cs" Inherits="HIPAAv2a.WebForm15" Title="Untitled Page" %>
Line 2:  
Line 3:  <%@ Register Assembly="Infragistics35.WebUI.Misc.v8.1, Version=8.1.20081.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
 

Source File: c:\Documents and Settings\hughesk.HDS\My Documents\Visual Studio 2005\Projects\HIPAAv2a\HIPAAv2a\AddFedReg.aspx    Line: 1
0
Comment
Question by:kwh3856
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:Gyanendra Singh
ID: 22764676
find line in code where SqlDataSource is using or you are getting value from it ... see this error explain that you are trying to convert that datasource in string ... which is not possible that is why you are getting error ..

else please paste your code here.
0
 

Author Comment

by:kwh3856
ID: 22766648
I think that is exactly my problem.  I did not use any code to do this.  I just dragged the drop down list control to the desktop and told it to use a data source.  I pointed the datasource at the table in the database.  Could I just point the data source to a stored procedure and then have the stored procedure do a select fieldname from xyztable?

Thanks
Kenny
0
 
LVL 16

Accepted Solution

by:
Gyanendra Singh earned 500 total points
ID: 22768133
hmm datasource should be object .. so it should be dataset or datatable ... .. i guess your binding giving the name of datatable ...

can you please paste that code
0
 

Author Closing Comment

by:kwh3856
ID: 31508155
Thanks BondinASP.  I appreciate your help.
0
 
LVL 16

Expert Comment

by:Gyanendra Singh
ID: 22869897
your welcome
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now