ASP.NET Tutorials
Tutorials
ASP.NETASP .NET Migration and Interoperability
Table of Contents
ASP .NET Migration and Interoperability
ASP .NET Migration and Interoperability - Page 2ASP .NET Migration and Interoperability - Page 2
strSQLQuery = "DELETE * FROM tablename WHERE Name = 'Fred' AND Address = 'Smith St'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strSQLQuery, conn, 3, 3
strSQLQuery = "DELETE * FROM tablename WHERE Name = 'Fred' OR Name = 'John'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strSQLQuery, conn, 3, 3
strSQLQuery = "UPDATE tablename SET FieldName1 = " & strValue1 & " WHERE FieldName2 = " & strValue2 & ";"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strSQLQuery, conn, 3, 3
strSQLQuery = "INSERT INTO tablename (FieldName1, FieldName2) VALUES (" & strValue1 & ", " & strValue2 & ")"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strSQLQuery, conn, 3, 3
Using Platform Invocation Services
Platform Invocation Services (PInvoke) allows managed code to call unmanaged functions that are implemented in a DLL.
This tutorial shows you what you need to do to be able to call unmanaged DLL functions from C#. The attributes discussed in the tutorial allow you to call these functions and have data types be marshaled correctly.
This is a simple example that shows how you can use the DllImport to import any dll file using C# code.
Platform Invocation Services (PInvoke) allows managed code to call unmanaged functions that are implemented in a DLL.
This tutorial shows you what you need to do to be able to call unmanaged DLL functions from C#. The attributes discussed in the tutorial allow you to call these functions and have data types be marshaled correctly.
This is a simple example that shows how you can use the DllImport to import any dll file using C# code.
// PInvokeTest.cs
using System;
using System.Runtime.InteropServices;
class PlatformInvokeTest
{
[DllImport("msvcrt.dll")]
public static extern int puts(string c);
[DllImport("msvcrt.dll")]
internal static extern int _flushall();
public static void Main()
{
puts("Test");
_flushall();
}
}
This example shows that how you can use DllImport to produce string.
// Marshal.cs
using System;
using System.Runtime.InteropServices;
class PlatformInvokeTest
{
[DllImport("msvcrt.dll")]
public static extern int puts(
[MarshalAs(UnmanagedType.LPStr)]
string m);
[DllImport("msvcrt.dll")]
internal static extern int _flushall();
public static void Main()
{
puts("Hello World!");
_flushall();
}
}
I hope you liked the tutorial and in the next tutorial we will learn about Session variables which are used to pass values arround.
First Page: ASP .NET Migration and Interoperability
