Code:
AnsiString Upit;
Upit= "select *from sys.databases where name like '%dboDelovna2%'"; //da mi izlista sve baze cije ime pocinje dboDelovna2...
....
....
AnsiString Upit;
Upit= "select *from sys.databases where name like '%dboDelovna2%'"; //da mi izlista sve baze cije ime pocinje dboDelovna2...
....
....
ako ne nadje nista daje mi mogucnost da kreiram novu bazu
Code:
//i ovo je funkcija koja kako argument prima ansistring t.e godinu
AnsiString Upit;
Upit= "create database dboDelovna" + DelovnaGodina;
Upit=Upit + " on( name = dboDelovna" + DelovnaGodina;
Upit=Upit + ", filename = 'C:\\Program Files\\Microsoft SQL Server\\MSSQL10_50.MSSQLSERVER\\MSSQL\\DATA\\dboiSProfessional" + dboDelovna;
Upit=Upit + ".mdf')";
Form2->ADOQuery1->Close();
Form2->ADOQuery1->SQL->Clear();
Form2->ADOQuery1->SQL->Add(Upit);
Form2->ADOQuery1->ExecSQL();
Form2->ADOQuery1->Active=true;
Upit="Use dboDelovna" + DelovnaGodina + ";";
Upit=Upit+"CREATE TABLE tblKorisnici ( KorisnikID int NOT NULL PRIMARY KEY IDENTITY(1,1), Ime nvarchar(50), Ulica nvarchar(100) )";
Form2->ADOQuery1->Close();
Form2->ADOQuery1->SQL->Clear();
Form2->ADOQuery1->SQL->Add(Upit);
Form2->ADOQuery1->ExecSQL();
Form2->ADOQuery1->Active=true;
//i ovo je funkcija koja kako argument prima ansistring t.e godinu
AnsiString Upit;
Upit= "create database dboDelovna" + DelovnaGodina;
Upit=Upit + " on( name = dboDelovna" + DelovnaGodina;
Upit=Upit + ", filename = 'C:\\Program Files\\Microsoft SQL Server\\MSSQL10_50.MSSQLSERVER\\MSSQL\\DATA\\dboiSProfessional" + dboDelovna;
Upit=Upit + ".mdf')";
Form2->ADOQuery1->Close();
Form2->ADOQuery1->SQL->Clear();
Form2->ADOQuery1->SQL->Add(Upit);
Form2->ADOQuery1->ExecSQL();
Form2->ADOQuery1->Active=true;
Upit="Use dboDelovna" + DelovnaGodina + ";";
Upit=Upit+"CREATE TABLE tblKorisnici ( KorisnikID int NOT NULL PRIMARY KEY IDENTITY(1,1), Ime nvarchar(50), Ulica nvarchar(100) )";
Form2->ADOQuery1->Close();
Form2->ADOQuery1->SQL->Clear();
Form2->ADOQuery1->SQL->Add(Upit);
Form2->ADOQuery1->ExecSQL();
Form2->ADOQuery1->Active=true;
Pa posle na svako citanje programa nekad procita bazu nekad ne i jos mnogoooo problecica....Ako moze neko da mi opise kako bi trebalo sve to da izgleda a ja da pokusam da to odradim? Hvala.