I am trying to save the varbinary[max] column in my database. For this, I have this code below:
public static void databaseFilePut(string varFilePath)
{
byte[] file;
using (var stream = new FileStream(varFilePath, FileMode.Open, FileAccess.Read))
{
using (var reader = new BinaryReader(stream))
{
file = reader.ReadBytes((int)stream.Length);
}
}
using (var varConnection = Locale.sqlConnectOneTime(Locale.sqlDataConnectionDetails))
using (var sqlWrite = new SqlCommand("INSERT INTO tblFiles2 (Data) Values(@File)",
varConnection))
{
sqlWrite.Parameters.Add("@File", SqlDbType.VarBinary, file.Length).Value = file;
sqlWrite.ExecuteNonQuery();
}
}
It is giving me error. The name 'locale' does not exist in the current context. Please tell me how can I fix this. I have used all the namespaces. I tried searching but could not find a single thing. Kindly help.