怎么把unsigned char[]插入数据库
本帖最后由 l848347 于 2012-12-13 15:24:53 编辑 数据库:access
struct Q
{
unsigned sn[8];
}PP;
cc(PP *p){
//使用托管
OleDbConnection ^myConnection = gcnew OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\data\\test.mdb");
try
{
myConnection->Open();
if (myConnection->State == ConnectionState::Open)
{
Console::WriteLine("Connection opened successfully");
OleDbCommand ^oleCmd = gcnew OleDbCommand
("insert into pub(iResult,aucSn) values(1,'asd')", myConnection);
oleCmd->ExecuteNonQuery();
}
else
Console::WriteLine("Connection could not be established");
}
catch(Exception ^ex)
{
Console::Write(ex->Message);
}
__finally
{
myConnection->Close();
}
}
int main()
{
PP s = {"1@-ad8"};
PP *pt = &s;
cc(pt);
return 0;
}
OleDbCommand ^oleCmd = gcnew OleDbCommand
("insert into pub(iResult,aucSn) values(1,'asd')", myConnection);
("insert into pub(iResult,aucSn) values(1,'"+p->sn+"')", myConnection);