Hi, I am trying to connect with the CRM database through c# console application, and I am using data reader to get the result, but I got the format error "Input string was not in a correct format",
sql = "select top 10 name from accountbase";
try
{
connection.Open();
command = new SqlCommand(sql, connection);
dataReader = command.ExecuteReader();
if (dataReader.HasRows)
{
while (dataReader.Read())
{
Console.WriteLine(String.Format("{ 0}", dataReader[0]));
}
}
dataReader.Close();
command.Dispose();
connection.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
*This post is locked for comments
I have the same question (0)