c# passing dblink to parameterized oracle query and connection string

950 views Asked by At

to avoid sql injection I am using parameterized oracle query, but i want to know how I can pass DBlink to the table and to the connection string ? as shown below

SELECT a.column1, a.column2,
             b.column3,a.column4,
             b.column5
  FROM SB_ACCOUNTS@dblink A, SB_CLIENTS@dblink B
 WHERE A.column1= B.column1
     AND column1=:P_PARAM;

and here is how i am passing dblink within the connection string from combobox

string dblink = "AB_" + CBCode.SelectedValue.ToString();
string connstr = @"Data Source=ORCL; User Id=" + dblink + "; password=pwd;";

i know how to pass Oracle Parameter within the query but hwo to do it with dblink and connection string ?

cmd.Parameters.Add(new OracleParameter(":P_PARAM", OracleDbType.Int64)).Value = Convert.ToInt64(Textbox.Text);

in other word how to change the dblink at runtime?

0

There are 0 answers