actually i m using visual studio 2012 i m a fresher sir
i m using class library for making a dll file for re-usability in to another ,
simply i want to display a table record in to gridview in the web form.
almost i tried 3rd solutions but its also not working in system
please see error and code
{
public class mycomponent
{
public DataSet getdata(string s)
{
SqlConnection con = new SqlConnection("userid = sa; password=123; database=inventory123; datasource=ICONLABS2-PC");
SqlDataAdapter da = new SqlDataAdapter(s, con);
DataSet ds = new DataSet();
da.Fill(ds,"t");
return(ds);
}
}
}
this is website app
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
databaselogic.mycomponent obj = new databaselogic.mycomponent();
DataSet ds = obj.getdata("select * from customers");
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
}
}
i got this error.
ERRORS:
Keyword not supported: 'userid'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Keyword not supported: 'userid'.
Source Error:
Line 12: {
Line 13: databaselogic.mycomponent obj = new databaselogic.mycomponent();
Line 14: DataSet ds = obj.getdata("select * from customers");
Line 15:
Line 16: GridView1.DataSource = ds.Tables[0];
Source File: e:\gnani\websites\databaselogicsite\Default.aspx.cs Line: 14
Stack Trace:
[ArgumentException: Keyword not supported: 'userid'.]
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +5327300
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +95
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +59
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +167
System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) +61
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +66
System.Data.SqlClient.SqlConnection..ctor(String connectionString, SqlCredential credential) +26
System.Data.SqlClient.SqlConnection..ctor(String connectionString) +6
databaselogic.mycomponent.getdata(String s) +87
_Default.Page_Load(Object sender, EventArgs e) in e:\gnani\websites\databaselogicsite\Default.aspx.cs:14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
please help me for this problem