How to generate the classes with .net code generator?
Working with .net code generator in some easy steps:
1st Download the software
from https://drive.google.com/folderview?id=0B3IxuTdeDTLTN1puUXZnVk9MT0U&usp=sharing
Then install the software
Run the software:
Click on the button MS access 2003.
Click on the select The Database Button.
Select the Database.
After selection the tables will come in the grid in this way
Now save to any folder .
Then Press OK.
Now your class will be generated and ready to work with your
application.
NOW THE QUESTION IS HOW?
This is my application screen:
Now if you want your class to work just add existing Item in
this manner.
YOUR CLASS IS NOW READY.
Please use pk_ for Primary key in all tables and try to make
them integer or auto number.
Pk_ is mandatory to
generate properly all classes and its related function.
The below class is auto generated.
And it will going to generate for all your tables.
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Data;
using System.IO;
using
System.Data.OleDb;
using
System.Drawing;
using
System.Drawing.Drawing2D;
namespace
GeneratedModuleClasses
{
class tblClassDetails
{
public
System.Int32 pk_intRecId { get; set; }
public
System.Int32 intRoll { get; set; }
public
System.String strClass { get; set; }
public
System.String strDesc { get; set; }
public
System.DateTime strDate { get; set; }
public
System.Byte[] Image { get; set; }
public
System.String hyperLink { get; set; }
public Boolean Create(String Conn )
{
try
{
DataTable
DT = new DataTable();
DT.Clear();
OleDbDataAdapter
ADP = new OleDbDataAdapter("Select * from tblClassDetails", Conn );
ADP.Fill(DT);
DataRow
Row = DT.NewRow();
Row["pk_intRecId"]
= pk_intRecId;
Row["intRoll"]
= intRoll;
Row["strClass"]
= strClass;
Row["strDesc"]
= strDesc;
Row["strDate"]
= strDate;
Row["Image"]
= Image;
Row["hyperLink"]
= hyperLink;
DT.Rows.Add(Row);
System.Data.OleDb.OleDbCommandBuilder Comb = new System.Data.OleDb.OleDbCommandBuilder(ADP);
ADP.Update(DT);
}
catch
(Exception Ex)
{
System.Windows.Forms.MessageBox.Show(Ex.ToString());
return
false;
} return
true;
}
public static Boolean
Edit(Int32 Pk_value, tblClassDetails EditObject, String Conn )
{
try
{
DataTable
DT = new DataTable();
DT.Clear();
OleDbDataAdapter
ADP = new OleDbDataAdapter("Select * from tblClassDetails where
pk_intRecId=pk_intRecId", Conn );
ADP.Fill(DT);
if
(DT.Rows.Count > 0)
{
DataRow
Row = DT.Rows[0];
Row["intRoll"] = EditObject.intRoll;
Row["strClass"] = EditObject.strClass;
Row["strDesc"] = EditObject.strDesc;
Row["strDate"] = EditObject.strDate;
Row["Image"] = EditObject.Image;
Row["hyperLink"] = EditObject.hyperLink;
System.Data.OleDb.OleDbCommandBuilder Comb = new System.Data.OleDb.OleDbCommandBuilder(ADP);
ADP.Update(DT);
}
else
{
return
false;
}
}
catch
(Exception Ex)
{
System.Windows.Forms.MessageBox.Show(Ex.ToString());
return
false;
} return
true;
}
public static List<tblClassDetails> GetnerateList(String
Conn )
{
List<tblClassDetails> tblClassDetails = new List<tblClassDetails>();
DataTable
DT = new DataTable();
DT.Clear();
OleDbDataAdapter
ADP = new OleDbDataAdapter("Select * from tblClassDetails", Conn );
ADP.Fill(DT);
foreach
(DataRow Row in
DT.Rows)
{
tblClassDetails
ob = new tblClassDetails();
try
{
ob.pk_intRecId = (System.Int32)Row["pk_intRecId"];
}
catch
(Exception Ex) { } try
{
ob.intRoll = (System.Int32)Row["intRoll"];
}
catch
(Exception Ex) { } try
{
ob.strClass = (System.String)Row["strClass"];
}
catch
(Exception Ex) { } try
{
ob.strDesc = (System.String)Row["strDesc"];
}
catch
(Exception Ex) { } try
{
ob.strDate = (System.DateTime)Row["strDate"];
}
catch
(Exception Ex) { } try
{
ob.Image = (System.Byte[])Row["Image"];
}
catch
(Exception Ex) { } try
{
ob.hyperLink = (System.String)Row["hyperLink"];
}
catch
(Exception Ex) { } tblClassDetails.Add(ob);
}
return
tblClassDetails;
}
}
}
DOWNLOAD THE CODE FROM HERE : https://drive.google.com/folderview?id=0B3IxuTdeDTLTN1puUXZnVk9MT0U&usp=sharing
I am creating an automated tool step by step.
I need proper feed back. Then those people who really need this kind of tool could send me their feedback.
Mail at ghosh315@gmail.com
No comments:
Post a Comment