Problems with a DataSet type function en C Sharp

ELIRDFUL 185 Reputation points
2023-11-21T22:16:18.8+00:00

Hello everyone

 

I am migrating from Vb.net to C Sharp

 

I have this function in Vb.net called TraeDataset.

User's image

I try to migrate this function to C Sharp, but it gives me an error.

User's image

I get the error in the DataSet.

 

I count on your help.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,962 questions
{count} votes

Accepted answer
  1. gekka 9,341 Reputation points MVP
    2023-11-21T23:35:10.44+00:00

    System.Data must be added to the using directive.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Data.SqlClient;
    using System.Data; // <<--
    

    or use DataSet with Full namespace

    public System.Data.DataSet TraeDataset(string sql)
    {
        var ds = new System.Data.DataSet();
    
    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. ELIRDFUL 185 Reputation points
    2023-11-22T22:03:32.6866667+00:00
    Solved 100x%
    
    Thank you....
    
    0 comments No comments

  2. ELIRDFUL 185 Reputation points
    2023-11-22T22:03:50.5933333+00:00
    Solved 100x%
    
    Thank you....
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.