All pastes #188153 Raw Edit

Shin-Ra

public text v1 · immutable
·published 2006-10-01 20:33 UTC
rendered paste body
public static int numberFields(string query)
    {
        SqlCommand comm = CreateCommand();
        comm.CommandText = query;
        int numFields = -1;
        try
        {
            comm.Connection.Open();
            numFields = comm.ExecuteReader().FieldCount;

        }
        catch (Exception ex)
        {
            throw ex.Message;
        }
        finally
        {
            comm.Connection.Close();
        }
        return numFields;
    }