如何将生物度量数据库连接到我们的SQL数据库,以便使用ASP.NET C#Web应用程序获取数据
问题描述:
大家好,
这里我想将生物识别数据库连接到我们的应用程序sql数据库以获取数据。
我的设备是identix k30型号。
这里我需要从生物识别数据库中获取数据到我的web应用程序。实际上我建立了连接。
使用下面的代码: -
Hi to all,
Here i want to connect biometric database to our application sql database for fetching data.
My devices is identix k30 model.
Here i need to fetch data from biometric databse to my web application.actually i established connection.
using below code:-
zkemkeeper.CZKEMClass axczkem1 = new zkemkeeper.CZKEMClass();
bool bIsConnected = false;
string ip = "192.168.1.10";//write here IP Address of your biomatric m/c
int port = 4370;
bIsConnected = axczkem1.Connect_Net(ip, port);
if (bIsConnected == true)
{
MessageBox.Show("Connection established!!!");
}
以上代码连接已建立。如何获取数据库。
我尝试了什么:
i建立连接,但我不知道如何连接该数据库。
for above code connection established.how to do fetch database.
What I have tried:
i established connection but i don't have any idea how to connect that database.
答
这是我在StackOverflow上找到的代码,你需要一个名为lvLogs的表单上的ListView才能使用它:
Here is come code that I found on StackOverflow, you need a ListView on your form named "lvLogs" to be able to use it:
//Download the attendance records from the device(For both Black&White and TFT screen devices).
private void btnGetGeneralLogData_Click(object sender, EventArgs e)
{
if (bIsConnected == false)
{
MessageBox.Show("Please connect the device first", "Error");
return;
}
string sdwEnrollNumber = "";
int idwTMachineNumber=0;
int idwEMachineNumber=0;
int idwVerifyMode=0;
int idwInOutMode=0;
int idwYear=0;
int idwMonth=0;
int idwDay=0;
int idwHour=0;
int idwMinute=0;
int idwSecond = 0;
int idwWorkcode = 0;
int idwErrorCode=0;
int iGLCount = 0;
int iIndex = 0;
Cursor = Cursors.WaitCursor;
lvLogs.Items.Clear();
axCZKEM1.EnableDevice(iMachineNumber, false);//disable the device
if (axCZKEM1.ReadGeneralLogData(iMachineNumber))//read all the attendance records to the memory
{
while (axCZKEM1.SSR_GetGeneralLogData(iMachineNumber, out sdwEnrollNumber, out idwVerifyMode,
out idwInOutMode, out idwYear, out idwMonth, out idwDay, out idwHour, out idwMinute, out idwSecond, ref idwWorkcode))//get records from the memory
{
iGLCount++;
lvLogs.Items.Add(iGLCount.ToString());
lvLogs.Items[iIndex].SubItems.Add(sdwEnrollNumber);//modify by Darcy on Nov.26 2009
lvLogs.Items[iIndex].SubItems.Add(idwVerifyMode.ToString());
lvLogs.Items[iIndex].SubItems.Add(idwInOutMode.ToString());
lvLogs.Items[iIndex].SubItems.Add(idwYear.ToString() + "-" + idwMonth.ToString() + "-" + idwDay.ToString() + " " + idwHour.ToString() + ":" + idwMinute.ToString() + ":" + idwSecond.ToString());
lvLogs.Items[iIndex].SubItems.Add(idwWorkcode.ToString());
iIndex++;
}
}
else
{
Cursor = Cursors.Default;
axCZKEM1.GetLastError(ref idwErrorCode);
if (idwErrorCode != 0)
{
MessageBox.Show("Reading data from terminal failed,ErrorCode: " + idwErrorCode.ToString(),"Error");
}
else
{
MessageBox.Show("No data from terminal returns!","Error");
}
}
axCZKEM1.EnableDevice(iMachineNumber, true);//enable the device
Cursor = Cursors.Default;
}