using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Data.SqlClient;
using System.IO;
namespace myMoney
{
class DB
{
const string connectionSting = ConfigurationManager.ConnectionStrings["myMoney.Properties.Settings.myMoneyConnectionString"].ConnectionString;
public static string GetSingleValue(string queryString)
{
object queryResult;
using (SqlConnection connection = new SqlConnection(
connectionSting))
{
SqlCommand command = new SqlCommand(queryString);
command.Connection = connection;
connection.Open();
queryResult = command.ExecuteScalar();
connection.Close();
return queryResult.ToString();
}
}
public static void WriteSingleValue(string updateString)
{
using (SqlConnection connection = new SqlConnection(connectionSting))
{
SqlCommand command = new SqlCommand(updateString);
command.Connection = connection;
connection.Open();
command.ExecuteNonQuery();
connection.Close();
}
}
}
}