Move From MSSQL Server to PostgreSQL

This is my code

Dim Rs As RecordSet
DIm ps as ODBCPreparedStatement
Dim sql As String
sql = “SELECT NumSocio FROM dbo.Socios WHERE flag is null and NumSocio = ?”
ps = me.Prepare(sql)
ps.BindType(0, ODBCPreparedStatement.ODBC_TYPE_STRING)
ps.Bind(0, NumSocio)
Rs = ps.SQLSelect
if me.Error then
MsgBox me.ErrorMessage
return false
end if
if Rs.EOF = false then
Rs.Close
return true
else
Rs.Close
return false
end if

the problem is ODBCPreparedStatement no compatible with PostgreSQLPreparedStatement.

so how i convert it

thanks

You’ll have to switch over to PostgreSQLPreparedStatement.

Documentation:

I tried to do it myself like you and it was a lot of work. I eventually decided to use a conversion tool from Intelligent Converters It converted pretty much everything correctly and I had very little manual work to do. Not very expensive either. I have several different databases to convert over time and the tool works with all of them.

if any way to connect to postgresql by ODBCDatabase using DSN on windows 10

Yes, see https://www.connectionstrings.com/postgresql-odbc-driver-psqlodbc/ . Not that I would have tried… But why would you want to do that? What’s wrong with using the built-in postgresqldatabase (via plugin) or Christian Schmitz’ MBS plugins?

ok
thanks