News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

interfacing with the .net framework and oledb

Started by fjb59, March 28, 2018, 07:10:27 AM

Previous topic - Next topic

fjb59

Are there any good examples on using the .net framwork from masm and using oledb?
Thank you

aw27

You need to make a bridge CLR .obj file to have access to the .Net and other Funtastic Microsoft Worlds.
In other words, you need to make the opposite that has been done here:
https://www.codeproject.com/Articles/266717/Mixing-Net-and-Assembly-Language-in-a-standalone

fjb59

Quote from: aw27 on March 28, 2018, 09:27:18 AM
You need to make a bridge CLR .obj file to have access to the .Net and other Funtastic Microsoft Worlds.
In other words, you need to make the opposite that has been done here:
https://www.codeproject.com/Articles/266717/Mixing-Net-and-Assembly-Language-in-a-standalone
You mean like making a clr class library project then importing it into my masm project?

aw27

Quote from: fjb59 on March 29, 2018, 02:54:17 AM
Quote from: aw27 on March 28, 2018, 09:27:18 AM
You need to make a bridge CLR .obj file to have access to the .Net and other Funtastic Microsoft Worlds.
In other words, you need to make the opposite that has been done here:
https://www.codeproject.com/Articles/266717/Mixing-Net-and-Assembly-Language-in-a-standalone
You mean like making a clr class library project then importing it into my masm project?
Not necessarily, the CLR is "IJW" (It Just Works). Make symbols public on the unmanaged part.
I have another example but will not post it because someone downvoted the article of the previous link. Too much of a coincidence, nobody ever did that before.


aw27

Probably, you should start by downloading the code from the link I provided. There was no downloads in the last few days but there was a downvote from some jerk.
I have nothing else to say about this.

fjb59

Quote from: aw27 on March 31, 2018, 01:56:58 AM
Probably, you should start by downloading the code from the link I provided. There was no downloads in the last few days but there was a downvote from some jerk.
I have nothing else to say about this.
Yeah i found it. I'll see what i can do with that. thank you.

mabdelouahab

 :biggrin:
I'm sorry I didn't notice your topic.

.invoke Connection.CreateInstance,"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=.\MyDataBase.mdb;Persist Security Info=true"
.invoke Connection.Open
.get, Connection.State
.if RAX==ConnectionState_Open
.invoke Command.CreateInstance
.set Command.Connection ,Connection

.set Command.CommandText ,"INSERT INTO Table1 (Field1,Field2)  VALUES (2018,'Masm64');";
.invoke Command.ExecuteNonQuery

.set Command.CommandText ,"Select * From Table1;";
.invoke Command.ExecuteReader ,addr vDataReader
MOV DataReader,RAX

@@:
.invoke DataReader.Read
CMP RAX,0
JE  @F
.invoke DataReader.GetInt32,0
invoke printf,"\n ID =%d,",RAX
.invoke DataReader.GetInt32,1
invoke printf," Field1 =%d,",RAX
.invoke DataReader.GetString,2
invoke wprintf,Of_Bstr(" ,Field 2 =%s"),RAX
jmp @B
@@:
invoke MessageBoxA,0,"operation complete",0,0
.else
invoke MessageBoxA,0,"Unable to open connection",0,0
.endif