Fill a dataset according to the query in propery SelectString

[Visual Basic]
Overridable Protected Function GetData() As Integer
[C#]
protected virtual int GetData();

Return Value

The number of rows in the dataset

Example

public DataSet GetAllDocumentsUser(int UserId)
            {
            	SourceTable="Documents";
            	SelectString = "SELECT * FROM Documents WHERE UserId="+UserId;
            	CmdType = CommandType.Text; 
            
            	int rowsAffected = GetData();
            	return DataSetToUse;
            }--------------
            or
            public DataSet GetAllDocumentsUser(int UserId)
            {
            		
            	SelectString = "--name of stored procedure--";
            	CmdType = CommandType.StoredProcedure;  //This must be set with a stored procedure
            		
            	selectParams = new SqlParameter[2];
            	//Specify the input/output parameters
            	selectParams[0] = new SqlParameter("@UserId", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "UserId", DataRowVersion.Current,"UserId");
            	
            	int rowsAffected = GetData();
            	return DataSetToUse;
            
            }

See Also

Reader Class | Reader Members | Magnusson.Data.SqlClient Namespace