Justin Cooney

Web Development Tips and Examples

Category: ADO.NET

  • In the example functions below I’m illustrating how to set up a basic query to a stored procedure in your database that takes a single string parameter. The examples involve using the SQLDataAdapter object to Fill a DataSet. The resulting DataTable can then be queried as desired. Specifically: The first example shows how to read the…

  • If you are working with XML data types in your .NET and SQL Server code, then you will most likely encounter this error message at some point. Specifically, this error is related to improperly passing an XML value as a SQLParameter to your database. Since most of the work one does with XML in .NET…

  • If you are adding parameters to a SqlCommand object then you can use either Parameters.Add or Parameters.AddWithValue. The Parameters.Add syntax requires you to explicitly specify the DataType of the parameter you are passing, while the Parameters.AddWithValue syntax implicitly attempts to convert the parameters you pass in. When choosing which method you want to use, you should be aware that…