Monday, March 26, 2012
Fill() problem in VS .NET 2003 in Windows application C# with SQL Server
with SQL Server and I get problem with method Fill() for which when
running ends with System Error even with the most simple cases which I
copied from a tutorial. everything else works right for ex Preview Data
except for example sqlDataAdapter1.Fill(ds1).
Is it a bug or some other kind of error. What should I do?
Dalius
Fill() problem in VS .NET 2003 in Windows application C# with SQL ServerI get :
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred
in system.data.dll
Additional information: System error.
"Auto" <dalius@.autocentras.com> wrote in message
news:uvWhT6X2DHA.1704@.tk2msftngp13.phx.gbl...
> I starting to use Visual Studio .NET 2003 creating C# Windows application
> with SQL Server and I get problem with method Fill() for which when
> running ends with System Error even with the most simple cases which I
> copied from a tutorial. everything else works right for ex Preview Data
> except for example sqlDataAdapter1.Fill(ds1).
> Is it a bug or some other kind of error. What should I do?
> Dalius
> Fill() problem in VS .NET 2003 in Windows application C# with SQL Server
>
>|||Post your code... The fill method does work, so I suspect you are doing
something funny... It might be a better place to post it in the dot net
groups, but Either place will do.
--
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Auto" <dalius@.autocentras.com> wrote in message
news:uciFeVa2DHA.3224@.tk2msftngp13.phx.gbl...
> I get :
> An unhandled exception of type 'System.Data.SqlClient.SqlException'
occurred
> in system.data.dll
> Additional information: System error.
>
> "Auto" <dalius@.autocentras.com> wrote in message
> news:uvWhT6X2DHA.1704@.tk2msftngp13.phx.gbl...
> > I starting to use Visual Studio .NET 2003 creating C# Windows
application
> > with SQL Server and I get problem with method Fill() for which
when
> > running ends with System Error even with the most simple cases which I
> > copied from a tutorial. everything else works right for ex Preview
Data
> > except for example sqlDataAdapter1.Fill(ds1).
> >
> > Is it a bug or some other kind of error. What should I do?
> >
> > Dalius
> >
> > Fill() problem in VS .NET 2003 in Windows application C# with SQL Server
> >
> >
> >
>|||Try executing the statement in a try/catch block so that you can get more
detailed info on the error:
try
{
Fill();
}
catch ( SqlException ex )
{
MessageBox.Show(ex.ToString());
}
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Auto" <dalius@.autocentras.com> wrote in message
news:uciFeVa2DHA.3224@.tk2msftngp13.phx.gbl...
> I get :
> An unhandled exception of type 'System.Data.SqlClient.SqlException'
occurred
> in system.data.dll
> Additional information: System error.
>
> "Auto" <dalius@.autocentras.com> wrote in message
> news:uvWhT6X2DHA.1704@.tk2msftngp13.phx.gbl...
> > I starting to use Visual Studio .NET 2003 creating C# Windows
application
> > with SQL Server and I get problem with method Fill() for which
when
> > running ends with System Error even with the most simple cases which I
> > copied from a tutorial. everything else works right for ex Preview
Data
> > except for example sqlDataAdapter1.Fill(ds1).
> >
> > Is it a bug or some other kind of error. What should I do?
> >
> > Dalius
> >
> > Fill() problem in VS .NET 2003 in Windows application C# with SQL Server
> >
> >
> >
>sql
Fill() problem in VS .NET 2003 in Windows application C# with SQL Server
with SQL Server and I get problem with method Fill() for which when
running ends with System Error even with the most simple cases which I
copied from a tutorial. everything else works right for ex Preview Data
except for example sqlDataAdapter1.Fill(ds1).
Is it a bug or some other kind of error. What should I do?
Dalius
Fill() problem in VS .NET 2003 in Windows application C# with SQL ServerI get :
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred
in system.data.dll
Additional information: System error.
"Auto" <dalius@.autocentras.com> wrote in message
news:uvWhT6X2DHA.1704@.tk2msftngp13.phx.gbl...
quote:|||Post your code... The fill method does work, so I suspect you are doing
> I starting to use Visual Studio .NET 2003 creating C# Windows application
> with SQL Server and I get problem with method Fill() for which when
> running ends with System Error even with the most simple cases which I
> copied from a tutorial. everything else works right for ex Preview Data
> except for example sqlDataAdapter1.Fill(ds1).
> Is it a bug or some other kind of error. What should I do?
> Dalius
> Fill() problem in VS .NET 2003 in Windows application C# with SQL Server
>
>
something funny... It might be a better place to post it in the dot net
groups, but Either place will do.
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Auto" <dalius@.autocentras.com> wrote in message
news:uciFeVa2DHA.3224@.tk2msftngp13.phx.gbl...
quote:
> I get :
> An unhandled exception of type 'System.Data.SqlClient.SqlException'
occurred
quote:|||Try executing the statement in a try/catch block so that you can get more
> in system.data.dll
> Additional information: System error.
>
> "Auto" <dalius@.autocentras.com> wrote in message
> news:uvWhT6X2DHA.1704@.tk2msftngp13.phx.gbl...
application[QUOTE]
when[QUOTE]
Data[QUOTE]
>
detailed info on the error:
try
{
Fill();
}
catch ( SqlException ex )
{
MessageBox.Show(ex.ToString());
}
Hope this helps.
Dan Guzman
SQL Server MVP
"Auto" <dalius@.autocentras.com> wrote in message
news:uciFeVa2DHA.3224@.tk2msftngp13.phx.gbl...
quote:
> I get :
> An unhandled exception of type 'System.Data.SqlClient.SqlException'
occurred
quote:
> in system.data.dll
> Additional information: System error.
>
> "Auto" <dalius@.autocentras.com> wrote in message
> news:uvWhT6X2DHA.1704@.tk2msftngp13.phx.gbl...
application[QUOTE]
when[QUOTE]
Data[QUOTE]
>
Friday, March 23, 2012
Fill a dataset in Visual Studio 2005
this may seem like a real newbie question, but I got no clue how to solve this problem. When I was working in Visual Studio 2003, whatever I wanted to fill a dataset with data, I was using a SqlDataAdapter that I created like this
adapTest.Fill(dsTest);
But now, I cant seem to find the sqldataadapter anywhere, I can just create (on the visual interface of one of my page of my aspx project) dataset, but cant find anywhere a adapter to put an SQL instruction into...maybe theres a new way to do this in Visual Studio 2005 that I dont know about. Im not sure if I was clear enough, but what I want in the end is to be able to use my dataset like that
dsTest.Tables.Rows[0]["a column"].ToString()
by filling the dataset with data like I was able to do in VS2003. Thanks for taking the time to read this.
Hey,
The preferred way now is the DataSource controls, which are great. You could use this by calling the Select method: http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.select.aspx
Maybe not as graceful; I think you can cast the returned object as a DataView, which could be useful. You may want to use those objects in code-behind.
|||I read about those DataSource controls. It seems all good and all, problem is, it seems I can only use them (at least that's the only way I found), with Data-Bound Controls. But I need to use the data literally in my code behind (like in a "if" or "for" instruction), without having to Bind it to a controls. Like you said, it may be possible to returns a dataview object (from what I can read on the link you gave me, its an object that will be always called Table), but can't seem to find how...Did I miss something? Is there a way to have access to the Data in a DataSource object without having to bind it on a control? Thanks again for taking the time to read this.|||Hey,
Sure, when you call select, it returns an IEnumerable object, which you can then convert to DataView, if it is indeed a dataview. From that, you can use you if/for logic. I believe it is, but I don't do that alot. You can also code the results in your page, using the SqlConnection and SqlDataAdapter, or Enterprise Library.
sql