Your second String.Format
uses {2}
as a placeholder but you’re only passing in one argument, so you should use {0}
instead.
Change this:
String.Format("{2}", reader.GetString(0));
To this:
String.Format("{0}", reader.GetString(2));
More Related Contents:
- How do I update a value in C# and SQL Server? [closed]
- Search SQL by date ASP.NET
- Error: You have an error in your SQL syntax – but SQL statement works
- Sql: Incorrect syntax near ‘(‘ [closed]
- how to get date difference between two dates using DateDiff Excluding the weekends [duplicate]
- LINQ to Entities does not recognize the method ‘System.String ToString()’ method, and this method cannot be translated into a store expression
- Is there a good LINQ way to do a cartesian product?
- Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints
- Entering keys manually with Entity Framework
- Read SQL Table into C# DataTable
- Pass table valued parameter using ADO.NET
- ASP.NET use SqlConnection connect MySQL
- LINQ to SQL multiple tables left outer join
- DropdownList DataSource
- Dynamic MySQL database connection for Entity Framework 6
- Stop SQL query execution from .net Code
- ASP.NET ODBC Query with parameters
- What is passing parameters to SQL and why do I need it?
- How to make LINQ execute a (SQL) LIKE range search
- Get affected rows on ExecuteNonQuery
- no overload for method “ToString” takes 1 arguments
- Database Error: There is no row at position 0
- In C#, what is the difference between public, private, protected, and having no access modifier?
- Dynamically Created Controls losing data after postback
- OutOfMemoryException while populating MemoryStream: 256MB allocation on 16GB system
- How to enable cross origin requests in ASP.NET MVC [duplicate]
- How to add OpenIdConnect via IdentityServer4 to ASP.NET Core ServerSide Blazor web app?
- How to ignore route in asp.net forms url routing
- Authentication Service using WCF
- Multiple signalR connections/hubs on your website