Janoproosse
New Member
Hi,<BR>I am getting this error.Can anyone tell me of y do I get such an error.<BR><BR>Error:<BR>DataGrid with id 'DataGrid1' could not auto-generate any columns from the selected data source. <BR><BR>My program is attached below:<BR><BR>Public Class WebForm1<BR> Inherits System.Web.UI.Page<BR> Protected WithEvents tbFirst As System.Web.UI.WebControls.TextBox<BR> Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid<BR> Protected WithEvents tblast As System.Web.UI.WebControls.TextBox<BR><BR>#Region " Web Form Designer Generated Code "<BR><BR> 'This call is required by the Web Form Designer.<BR> <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()<BR><BR> End Sub<BR><BR> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init<BR> 'CODEGEN: This method call is required by the Web Form Designer<BR> 'Do not modify it using the code editor.<BR> InitializeComponent()<BR> End Sub<BR><BR>#End Region<BR><BR> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<BR> 'Put user code to initialize the page here<BR> Dim strConnect As String = "Provider=SQLOLEDB;data source=localhost;initial catalog=Ideal;UID=sa;pwd=;"<BR> Dim objConnect As New OleDbConnection(strConnect)<BR> Dim objCommand As New OleDbCommand("Test", objConnect)<BR> Dim objReader As OleDbDataReader<BR><BR> objCommand.CommandType = CommandType.StoredProcedure<BR><BR> Dim objParam As OleDbParameter<BR> objParam = objCommand.Parameters.Add("@FName", OleDbType.Char)<BR> objParam.Direction = ParameterDirection.Input<BR> objParam.Value = http://aspmessageboard.com/archive/index.php/tbFirst.Text<BR><BR> objParam = objCommand.Parameters.Add("@PWord", OleDbType.Char)<BR> objParam.Direction = ParameterDirection.Input<BR> objParam.Value = tblast.Text<BR><BR> Try<BR> objCommand.Connection.Open()<BR> objReader = objCommand.ExecuteReader<BR> Catch ex As OleDb.OleDbException<BR> Response.Write("Error retrieving data.")<BR> End Try<BR><BR> DataGrid1.DataSource = objReader<BR> DataGrid1.DataBind()<BR> objCommand.Connection.Close()<BR><BR> End Sub<BR><BR><BR>thx<BR>WhiteI found the error.I gave different data source name.