如何使用c#通过odbc执行存储过程?

use*_*047 3 c# odbc sybase-ase c#-4.0

如何使用c#通过odbc执行存储过程?

我想执行它而没有sql注入的风险,我该怎么办?

Mas*_*uso 7

using (OdbcConnection connection = new OdbcConnection(connectionString))
using (OdbcCommand command = connection.CreateCommand())
{
    command.CommandText = commandText //your store procedure name;
    command.CommandType = CommandType.StoredProcedure;

    command.Paremeters.Add("@yourParameter", OdbcType.NChar, 50).Value = yourParameter

    DataTable dataTable = new DataTable();

    connection.Open();    
    using (OdbcDataAdapter adapter = new OdbcDataAdapter(command))
    {
        adapter.Fill(dataTable);
    }
}
Run Code Online (Sandbox Code Playgroud)