我使用visual studio 2010来设计网页,我使用了这个图层
编程,我使用gidview和objectdatasource,但我得到这个例外:
"The type 'WebApplication4.view1' is ambiguous: it could come from assembly
'C:\Users\EHSAN\AppData\Local\Temp\Temporary ASP.NET
Files\root\d04444bc\d654bde6\App_Code.i0fp6yrj.DLL' or from assembly
'C:\Users\EHSAN\Documents\Visual Studio
2010\Projects\WebApplication4\WebApplication4\bin\WebApplication4.DLL'. Please
specify the assembly explicitly in the type name."
Run Code Online (Sandbox Code Playgroud)
我把我的代码放在这里:
这是我的web.aspx:
<asp:ObjectDataSource ID="ObjectDataSource1" Runat="server" TypeName="WebApplication4.view1"
SelectMethod="Search" OldValuesParameterFormatString="original_{0}" >
</asp:ObjectDataSource>
Run Code Online (Sandbox Code Playgroud)
这是APP_Code中BAL文件夹中的search.cs文件:
namespace WebApplication4
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Data;
public class view1 : System.Web.UI.Page
{
public view1()
{ }
public List<person> Search()
{
List<person> persons = new List<person>();
DataSet ds = PersonsDB.Search();
foreach …Run Code Online (Sandbox Code Playgroud) 我已经安装了vs2010,现在我使用"SQLEXPRESS"连接到数据库,但现在我想使用sqlserver 2008 directy而不是SQLEXPRESS; 更多解释:
sql express有这个连接字符串(例如):(我不想用它!)
connection.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\EHSAN\Documents\Visual Studio 2010\Projects\hokm\hokm\App_Data\database1.mdf;Integrated Security=True;User Instance=True";
Run Code Online (Sandbox Code Playgroud)
但是我想使用这个命令(对于ex):
Server=localhost;Database=xxx;User " +"ID=xx;Password=xxxx;
Run Code Online (Sandbox Code Playgroud)
而且我不知道如何创建一个想要这个连接字符串的数据库!