16,017,167 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by aciobanita constantin (Top 13 by date)
aciobanita constantin
28-Apr-16 14:11pm
View
The pice of code were I get the error is new oledbadapder.fill, and is a null reference, only inside the Beck round worker Dowork,
aciobanita constantin
28-Apr-16 14:09pm
View
Is an abstract error, null reference on new oledbadapder.fill
aciobanita constantin
26-Jan-15 3:19am
View
So, on click dgv1 - the dgv2 may have or not record, if dgv2 has record, dgv3 and dgv4 has records, if dgv2 has no record, dgv3 and dgv4 not have record (this is OK), but a succes show the record on dgv2, when i change row from the dgv1 and dgv2 has no records (this can occur and is OK), the dgv3 and dgv4 has the same record from the firs select dgv1, in this situation dgv3 and dgv4 must not have records - how to empy (has datasource), i try with dgv1.Update().
aciobanita constantin
29-Oct-14 13:57pm
View
class MyAccessConnection : DataConnection
{
OleDbConnection Connection;
OleDbCommand Command;
OleDbTransaction OperatieDate;
string ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DataSource + ";Persist Security Info=True;Jet OLEDB:Database Password=" + Password + ";";
public MyAccessConnection()
{
(Command = new OleDbCommand()).Connection = Connection = new OleDbConnection(ConnectionString);
ConnectionDistructor = new System.Timers.Timer(60000);
GC.KeepAlive(ConnectionDistructor);
}
public override void InceputTranzactie()
{
OperatieDate = Connection.BeginTransaction(IsolationLevel.ReadCommitted);
Command.Connection = Connection;
Command.Transaction = OperatieDate;
}
public override void CommitTranzaction()
{
OperatieDate.Commit();
}
public override void RollBackTranzaction()
{
OperatieDate.Rollback();
}
public override void FillDataTable(DataTable Table, bool Decrypt)
{
ConnectionDistructor.Enabled = false;
if (Connection.State == System.Data.ConnectionState.Closed) Connection.Open();
Status.Text = "1";
try
{
Table.Rows.Clear();
Table.Columns.Clear();
new OleDbDataAdapter(Command).Fill(Table);
//Table.Rows[1].ItemArray;
int StartIndex = 1;
try
{
if (Table.Rows.Count > 0)
Table.Rows[0][0].ToString();
if (Table.Rows.Count > 1)
Table.Rows[1][0].ToString();
}
catch { StartIndex++; }
for (int i = StartIndex; i < Table.Columns.Count; i++) for (int j = 0; j < Table.Rows.Count; j++)
Table.Rows[j][i] = Table.Rows[j][i].ToString();
}
catch (Exception Ex) { throw Ex; }
finally { Command.Parameters.Clear(); ConnectionDistructor.Enabled = true; }
}
public override object ExecuteNonQuery()
{
ConnectionDistructor.Enabled = false;
if (Connection.State == System.Data.ConnectionState.Closed) Connection.Open();
Status.Text = "1";
try
{
return Command.ExecuteNonQuery();
}
catch (Exception Ex) { throw Ex; }
finally { Command.Parameters.Clear(); ConnectionDistructor.Enabled = true; }
}
public override string CommandText
{
set
{
Command.CommandText = value;
}
}
public override void AddParameter(string Name, object Value)
{
AddParameter(Name, Value, true);
}
public override void AddParameter(string Name, object Value, bool Encrypt)
{
Command.Parameters.Add(new OleDbParameter(Name, Value));
}
public override void Open()
{
Connection.Open();
}
public override void Close()
{
Connection.Close();
}
aciobanita constantin
29-Oct-14 13:55pm
View
ok,
public static DataConnection Connection;
[STAThread]
static void Main()
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("ro-RO");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("ro-RO");
.......
here is the DataConection class:
class DataConnection
{
public System.Timers.Timer ConnectionDistructor;
public static System.Windows.Forms.TextBox Status = new System.Windows.Forms.TextBox();
public static string DataSource = "";
public static string Database = "";
public static string UserName = "";
public static string Password = "";
public static int ConnectionType = -1;
public static int SQLAuthenticationType;
public static void SaveSettings()
{
StreamWriter SW = new StreamWriter(System.Windows.Forms.Application.StartupPath + "\\Setari.dat");
SW.Write(Converter.Encrypt(DataSource));
SW.Write("\n" + Converter.Encrypt(Database));
SW.Write("\n" + Converter.Encrypt(UserName));
SW.Write("\n" + Converter.Encrypt(Password));
SW.Write("\n" + Converter.Encrypt(ConnectionType.ToString()));
SW.Write("\n" + Converter.Encrypt(SQLAuthenticationType.ToString()));
SW.Close(); SW = null;
(Program.Connection = GetConnection()).Open();
Program.Connection.InitialiseDatabase();
}
public static void GetSettings()
{
StreamReader SR = new StreamReader("Setari.dat");
DataSource = Converter.Decrypt(SR.ReadLine());
Database = Converter.Decrypt(SR.ReadLine());
UserName = Converter.Decrypt(SR.ReadLine());
Password = Converter.Decrypt(SR.ReadLine());
ConnectionType = Convert.ToInt32(Converter.Decrypt(SR.ReadLine()));
SQLAuthenticationType = Convert.ToInt32(Converter.Decrypt(SR.ReadLine()));
SR.Close(); SR = null;
}
public static DataConnection GetConnection()
{
if (((ConnectionTypes)ConnectionType) == ConnectionTypes.AccessConnection)
return new MyAccessConnection();
if (((ConnectionTypes)ConnectionType) == ConnectionTypes.MySQLConnection)
return new MySqlConnection(); return new MsSqlConnection();
}
public virtual void AddParameter(string Name, object Value) { }
public virtual void AddParameter(string Name, object Value, bool Encrypt) { }
public virtual void FillDataTable(DataTable Table, bool Decrypt) { }
public virtual string CommandText { set { } }
public virtual object ExecuteNonQuery()
{
return new object();
}
public virtual void Open() { }
public virtual void Close() { }
public virtual void InitialiseDatabase() { }
public virtual void InceputTranzactie() { }
public virtual void CommitTranzaction() { }
public virtual void RollBackTranzaction() { }
}
aciobanita constantin
29-Oct-14 13:39pm
View
no, i have created that class for retrive, update and save information in database.
aciobanita constantin
29-Oct-14 12:22pm
View
i have add some code to my question.
aciobanita constantin
28-Sep-14 10:04am
View
I have selection criteria, maybe i will never need tho show all the records. just to be there to show all.
aciobanita constantin
21-Jul-14 2:15am
View
i didn't down-voted. you didn't understand my questions. Add Ctrl+P functionality in the PrinPreview Control
aciobanita constantin
11-Feb-13 4:18am
View
I can't remove GROUP BY, my query will not work whiteout GROUP BY.
aciobanita constantin
4-Feb-13 8:40am
View
This is the code to populate my combobox:
Program.Connection.CommandText = "SELECT LastName + ', ' + FirstName + ' ' + IIF(MiddleName, MiddleName,'') AS NumeComplet, ClientId FROM Clients GROUP BY ClientId, LastName, FirstName, MiddleName ORDER BY ClientId";
DataTable Table = new DataTable();
Program.Connection.FillDataTable(Table, true);
cboNumeClient.DataSource = Table;
cboNumeClient.DisplayMember = "NumeComplet";
cboNumeClient.ValueMember = "ClientId";
cboNumeClient.Focus();
the conection stings are in a separate class.
aciobanita constantin
4-Feb-13 8:35am
View
Yes.
So, i have a class where i execute the sql queries (SetariAmanet.cs). I send to that class an ID. And i have a the class Contract.cs, and IstoricContract.cs (this is tha class with the information that i need). In the class Contract.cs i have created from
..
internal static IstoricContracte[] IstoricContracte(int contractId)
.. then execute
public IstoricContracte[] IstoricOperatii
{
get
{
return SetariAmanet.IstoricContracte(this.numarContract);
}
}
to obtain the information for a specific ID.
In SetariAmanet.cs i try to convert a datatable theat is created from
private static T[] Lista<t>(DataTable valoare, Converter<datatable, t=""> creaza)
{
List<t> list = new List<t>();
if (valoare != null)
{
list.Add(creaza(valoare));
}
return list.ToArray();
}
return the list.
I don't know exactly how to execut in that order my code from my form, and the return list to populate a datagridview.
aciobanita constantin
1-Feb-13 15:03pm
View
Yes, the ClientID is different, is the primarykey in my database.
Show More