[BCB] Dynamicznie TSQLDataSet Problem

0

Witam [???]

Mam problem z dynamicznym tworzeniem komponentu TSQLDataSet po nacisniecu Buttona wyskakuje:
"Access violation at address XXXXXXX in module 'dbxopenmysql50.dll'. Write of address XXXXXX".
Problem pojawia sie przy tworzeniu parametru do zapytania ->

	SQLdata->Params->CreateParam(ftBlob,"id_d",ptUnknown);
	SQLdata->ParamByName("id_d")->AsInteger = 16;

Plik SQLtestVI.cpp ->

#include <vcl.h>
#pragma hdrstop
#include "SQLtestVI.h"
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
	// Tworzymy Komponenty
	SQLpolaczenie = new TSQLConnection(this);
	SQLdata = new TSQLDataSet(this);

	SQLpolaczenie->Params->Values["HostName"] = "localhost";
	SQLpolaczenie->Params->Values["Database"] = "roman";
	SQLpolaczenie->Params->Values["User_Name"] = "roman";
	SQLpolaczenie->Params->Values["Password"] = "roman";
	SQLpolaczenie->Params->Values["DriverName"] = "MySQL";
	SQLpolaczenie->Params->Values["GETDRIVERFUNC"] = "getSQLDriverMYSQL50";
	SQLpolaczenie->ConnectionName = "MYSQLCONNECTION";
	SQLpolaczenie->DriverName = "MYSQL";
	SQLpolaczenie->GetDriverFunc = "getSQLDriverMYSQL50";
	SQLpolaczenie->KeepConnection = "true";
	SQLpolaczenie->LibraryName = "dbxopenmysql50.dll";
	SQLpolaczenie->VendorLib = "LIBMYSQL.dll";
	SQLpolaczenie->LoginPrompt = false;
	SQLpolaczenie->ConnectionName = "Test";
	SQLpolaczenie->Connected = true;

	// Zapytanie do bazy
	SQLdata->SQLConnection = SQLpolaczenie;
	SQLdata->CommandType = ctQuery;
	SQLdata->CommandText = "SELECT * FROM roman WHERE id=:id_d";
	SQLdata->Params->CreateParam(ftInteger,"id_d",ptInput);
	SQLdata->ParamByName("id_d")->AsInteger = 16;
	SQLdata->MaxBlobSize = 0;
	/*
	SQLdata->ObjectView = false;
	SQLdata->GetMetadata = true;
	SQLdata->NumericMapping = false;
	SQLdata->Tag = 0;
	SQLdata->ParamCheck = false;
	*/
	SQLdata->Active = true;
//	SQLdata->Open();
//	SQLdata->ExecSQL();

}

Plik SQLtestVI.h

#ifndef SQLtestVIH
#define SQLtestVIH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <DBXpress.hpp>
#include <FMTBcd.hpp>
#include <SqlExpr.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
	TButton *Button1;
	void __fastcall Button1Click(TObject *Sender);
private:	// User declarations
public:		// User declarations
TSQLConnection *SQLpolaczenie;
TSQLDataSet *SQLdata;
	__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

Prosze o pomoc :)

0

Rozwiązałem problem :)

[diabel] Sorry za nadgorliwość gorszą od faszyzmu ...

Moj blad polegal na tym ze nie utworzylem obiektu TParams w ktorym to obiekcie powinienem utworzyc
parametr ...


TParams *Henryk = new TParams(this);

Henryk->CreateParam(ftInteger,"prostata",ptInput);
Henryk->Items[0]->AsInteger = 0;

Pozdrawiam [soczek]

1 użytkowników online, w tym zalogowanych: 0, gości: 1