Technical Training
ASP.NET TrainingTable of Contents
ASP .NET Migration and Interoperability
ASP .NET Migration and Interoperability - Page 2ASP .NET Migration and Interoperability Page - 2
ASP .NET Migration and Interoperability
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.
ASP.NET Training
- ASP.NET with C# Training Launch
- ASP.NET with C# Training Course Outline
- Introduction to ASP.NET with C#
- ASP.NET Web Forms Controls
- ASP .NET: Validating User Input with C#
- Using Rich Server Controls with C#
- Accessing Data with C#
- ASP.NET Using the DataList and Repeater, Datagrid Controls
- Managing Data with ADO.NET DataSets and C#
- Creating and consuming XML Web Services with C#
- ASP .NET Migration and Interoperability
- Managing State with ASP.NET and C#
- Caching in ASP.NET
- Configuring and Deploying ASP.NET Applications
- Securing ASP.NET Applications with C#







