Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 23rd, 2003, 05:56 PM
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need Help in System.Data.SQL

hi :)
today´s my first day in C#
i need some help, why i can´t compile de following code, im using the line:
csc /t:library /r:System.Data.dll /out:connect_base.dll connect_base.cs

thanks

using System;
using System.Data;
using System.Data.SqlClient;


public class Listaserv
{
    public DataSet Listatel()
    {

        SQLConnection objconn = new SQLConnection("server=localhost;uid=sa;pwd=;databa se=pubs");
        SQLDataSetCommand objcomm = new SQLDataSetCommand("SELECT au_fname,au_lname,phone FROM Authors", objconn);
        DataSet objds = new DataSet();
        objcomm.FillDataSet(objds, "dsvListatel");
        return objds;
    }
}
 
Old August 24th, 2003, 02:05 AM
Authorized User
 
Join Date: Jun 2003
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to planeswalk
Default

Hi,

You need to add /r:System.dll in your csc command paramaters to compile your class, since you are using the System namespace. Something like this:

csc /t:library /r:System.dll /r:System.Data.dll /out:connect_base.dll connect_base.cs

Cheers!


Marlon Villarama
Support Team
Web Burner Hosting
marlon@webburner.com
www.webburner.com
Toll-Free: 877-535-2876
 
Old August 24th, 2003, 10:28 AM
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi...
thank you...
the correct to connect is:
i was using classes tha does not belong to the System.Data.SqlClient,
ande also using SQLConnection when the corretc is SqlConnection.
well, at least i compiled :)

using System;
using System.Data;
using System.Data.SqlClient;





    public class Listaserv
    {
        public DataSet Listatel()
        {
            SqlConnection conn = new SqlConnection("server=localhost;uid=sa;pwd=;databa se=pubs");
            SqlDataAdapter adapter = new SqlDataAdapter();
            adapter.SelectCommand = new SqlCommand("SELECT au_fname,au_lname,phone FROM Authors", conn);
            DataSet objds = new DataSet();
            adapter.Fill(objds);
            return objds;

        }
    }








Similar Threads
Thread Thread Starter Forum Replies Last Post
System Data Types liamfitz Beginning VB 6 0 October 17th, 2006 05:31 PM
'SYSTEM.DATA.SQLCLIENT.SQLEXCEPTION' soorsha General .NET 0 September 23rd, 2006 11:59 PM
'System.Data.DataRowView' does not contain a prope kenn_rosie VS.NET 2002/2003 0 May 1st, 2006 09:53 PM
Update SQL table with data from FoxPro system sofya SQL Server 2000 6 November 4th, 2004 06:45 PM
'System.Data.ConstraintException' - HELP PLEASE AlanBell ADO.NET 1 July 1st, 2003 02:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.