当前位置: 动力学知识库 > 问答 > 编程问答 >

the call is ambiguous between the same methods Asp.Net C#

问题描述:

I tried to edit a GridView in one of the pages of my site, topics.aspx. I decided to change the DataSourceID, from the one I put in design view on the grid view, with a custom one, following this tutorial

http://www.c-sharpcorner.com/uploadfile/9f0ae2/gridview-edit-delete-and-update-in-asp-net/?authorFollow=true-9f0ae2-article&name=neha-sharma52

I COPIED and PASTED the exact SqlConnection from the register.aspx.cs page, which is

SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

as a private field in topic.aspx.cs.

Suddenly, my register page doesn't work anymore. The "SqlConnection" in

new SqlConnection(...)

call is "ambigous" between

SqlConnection.SqlConnection(string)

and

SqlConnection.SqlConnection(string)

I undid everything I did, obviously. My last resort is to delete topics.aspx and topics.aspx.cs altogether, but... will it work then? I highly doubt did.

I don't know what i did wrong, I only copied and pasted a line of code, and suddenly, my register.aspx and login.aspx don't work anymore. What is the problem?

EDIT:

The imports I am using are

using System;

using System.Collections.Generic;

using System.Configuration;

using System.Data.SqlClient;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

网友答案:

If your connection string doesn't use Integrated Security = true you can try SqlConnection(String, SqlCredential) or just call default constructor

分享给朋友:
您可能感兴趣的文章:
随机阅读: