using Microsoft.Win32;
using System.Runtime.InteropServices;
[DllImport("ODBCCP32.dll")]
private static extern bool SQLConfigDataSource(IntPtr parent, int request, string driver, string attributes);
private void btnDsn_Click(object sender, EventArgs e)
{
string str = "SERVER=MYDBSERVER\0DSN=MYDSN\0DESCRIPTION=MYDSNDESC\0DATABASE=master\0TRUSTED_CONNECTION=YES";
SQLConfigDataSource((IntPtr)0, 4, "SQL Server
",str);
}
Reference :
http://social.msdn.microsoft.com/Forums/en-US/vscrystalreports/thread/441811b9-c4e9-4d15-97a3-7b92d2c9f318
Can anybody help me remove the following errors??
Error 1 Expected class, delegate, enum, interface, or struct C:\Documents and Settings\Pavan\My Documents\Visual Studio 2008\Projects\CopyDatabase\CopyDatabase\Synchronize.cs 17 23 CopyDatabase
Error 2 The name 'SQLConfigDataSource' does not exist in the current context C:\Documents and Settings\Pavan\My Documents\Visual Studio 2008\Projects\CopyDatabase\CopyDatabase\Synchronize.cs 67 13 CopyDatabase