Insert ASCII string with Oracle client


T

TruongLapVi

Hi,

I want to insert an ASCII string using ODP.NET. Example

string sql = "INSERT INTO Employee(id, name) VALUES(1, :name)" // name is
VARCHAR2(40)
OracleCommand cm = new OracleCommand();
OracleParameter param = cm.CreateParameter();
param.ParameterName = "name";
param.DbType = DbType.AnsiString;
param.Size = 40
param.Value = ".Net Framework Unicode string."; // 30 unicode characters
cm.Parameters.Add(param);

I want to insert only ASCII string, but, because .Net string is Unicode
string, ".Net Framework Unicode string." got 30 * 2 = 60 bytes AND Oracle
say that my string is too long.

How can I fix this ?

Thanks
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top