I am uploading a file to \temp\ but I want to access it through a hyperlink in a given column inside Access. I can successfully paste the string to the hyperlink field, but there´s no link between the string and the file itself.
I tried to copy paste a website address from a browser to Access, surprisingly the hyperlink is pasted along with the "string"
//upload arquivo
string conexaoAccess2 = ConfigurationManager.ConnectionStrings["conexaoAccess"].ToString();
using (OleDbConnection conexaodb1 = new OleDbConnection(conexaoAccess2))
{
conexaodb1.Open();
Random r = new Random();
int n = r.Next();
// pega somente nome
string[] f = camArq.Split('\\');
string fn = f[(f.Length) - 1];
string fullDest = @"C:\temp\" + nomeArqnoExt + n + fileExtension0;
string q = "UPDATE tbl_reg SET Campo1 = @campo WHERE nome_user = @nome1";
//copia arquivo para a pasta destino
File.Copy(camArq, fullDest, true);
//to save to the database
OleDbCommand cmd = new OleDbCommand(q, conexaodb1);
var parCamp = cmd.CreateParameter();
parCamp.ParameterName = "campo";
parCamp.DbType = DbType.String;
parCamp.Value = fullDest;
cmd.Parameters.Add(parCamp);
var parNome1 = cmd.CreateParameter();
parNome1.ParameterName = "nome1";
parNome1.DbType = DbType.String;
parNome1.Value = mdl.nome;
cmd.Parameters.Add(parNome1);
cmd.ExecuteNonQuery();
}
I expect the string to be copied as an hyperlink, nevertheless, there´s no DbType that assumes this type of data, is there? The actual results are: I can successfully paste the file path to the field, but the field contains no hyperlink to anything whatsoever: