SQLPreparedStatementMBS & SQLCommandMBS

I am in the process of moving over to SQLCommandMBS from SQLDatabaseMBS in which I am trying to find examples where SQLDatabaseMBS uses SQLPreparedStatementMBS.

does SQLCommandMBS integerate with SQLPreparedStatementMBS? If so, does anyone have sample code I can look at?

SQLPreparedStatementMBS and SQLCommandMBS both internally use the same C++ SACommand class.

Thank you Christian,

I am trying to convert the following code:

var dbNative as new SQLDatabaseMBS

dbNative.DatabaseName = "SQLServer:" + configMDL.cfgServer + "@" + configMDL.cfgDatabase
dbNative.Option("OLEDBProvider") = "SQLNCLI10"
dbNative.UserName = configMDL.cfgUser
dbNative.Password = configMDL.cfgPassword

if dbNative.Connect then
  var sql as string = "P_SYS_LOG_INSERT :monitor_pk, :watermark_low, :watermark_high, :monitor_value, :monitor_status, :monitor_action, :monitor_comments;"
  var ps as SQLPreparedStatementMBS = dbNative.Prepare(sql)
  ps.Bind("monitor_pk", monitorPk, ps.kTypeNumeric)
  ps.Bind("watermark_low", watermarkLow, ps.kTypeNumeric)
  ps.Bind("watermark_high", watermarkHigh, ps.kTypeNumeric)
  ps.Bind("monitor_value", monitorValue, ps.kTypeNumeric)
  ps.Bind("monitor_status", monitorStatus, ps.kTypeString)
  ps.Bind("monitor_action", monitorAction, ps.kTypeString)
  ps.Bind("monitor_comments", monitorComments, ps.kTypeString)
  if dbNative.Error then
    msgbox "ERROR: " + dbNative.ErrorMessage
  end if
  msgbox "ERROR: " + dbNative.ErrorMessage
end if

do you have an example of how I can use a prepared statement with SQLCommandMBS?

Something like this shows the code:

[code]Dim cmd As New SQLCommandMBS(con, “Insert into test_tbl(fid, fvarchar20) values(:a, :b)”)

// use first method of binding - param assignment
cmd.Param(“b”).setAsString(“Some string (2)”)
// Insert first row

you can find such code in our examples.

Christian, you are a life saver!

thank you for taking the time to provide sample code. With regards to your example projects, you have so many and might have missed the example project that contained guidance.