跟进这个 我还阅读了一些其他问题,但我不明白是什么导致这种情况发生。权限?如何申请变通?什么是跛脚?
我被定向到THIS教程,并将其放入 C# 程序中以在按钮单击上执行。
但是我在这条线上得到一个错误
[DllImport("ODBCCP32.dll")]
陈述
The type or namespace name "DllImport" could not be found (are you missing a using directory or an assembly reference?)
我曾尝试将该文件作为参考导入,但随后遇到此错误
"Please make sure file is accessile, and that it is a valid assembly or COM component"
我错过了我需要进口的东西吗?这是我的代码的一部分。
using System;
using System.Runtime.InteropServices;
namespace DsnUtil{
public partial class Form1 : Form{
[DllImport("ODBCCP32.dll")]
private static extern bool SQLConfigDataSource(//etc etc)
public Form1(){
button1_Click();
}
private void button1_Click(object sender, EventArgs e){
//DoesWork
}
}