Tuesday, October 6, 2009

A Complete but Simplest Access-Perl DBI connectivity program!!




















I searched a lot for simple but complete basic DBI-Access Connectivity example in web.. and I got none..
So I created one for myself!!:)
Program is testes in WIN-XP, ActivePerl,MS-Access environment.

  1. Create a database called Data in Access.
  2. Create a table Called Data table in it with ID(AutoNumber),Name,Marks field
  3. Then fill the table with whatever appropriate values you want.
  4. Create a System DSN(Here its name is 'DSN', Give any name you want!!)by going to Control Panel->Administrative Tools->Data Sources.
  5. Execute the program

use DBI;
print "Database Retrieve";
$dbh=DBI->connect('dbi:ODBC:DSN');

print "\n\nSEE ORIGINAL DATABASE";
$see="Select * from DataTable";
$holdnew=$dbh->prepare($see);
$holdnew->execute|| die "Sorry Kanree!!";
while(@row=$holdnew->fetchrow_array)
{print("\n@row\n");}

print "\n\nNow Insert A new name NEW and 100 Marks for same name name";

$insert="INSERT into DataTable (Name,Marks) VALUES ('New','100')";
$insert_handle=$dbh->prepare($insert);
$insert_handle->execute();


print "\n\nSee Inserted DataBase";
$see="Select * from DataTable";
$holdnew=$dbh->prepare($see);
$holdnew->execute|| die "Sorry Kanree!!";
while(@row=$holdnew->fetchrow_array)
{print("\n@row\n");}


print "\n\n Let Us Update Database where ID=1 with 600";
$update="UPDATE DataTable SET Marks = '600' WHERE ID=1 ";
$update_handle=$dbh->prepare($update);
$update_handle->execute();

print "\n\nSee Updated DataBase";
$see="Select * from DataTable";
$holdnew=$dbh->prepare($see);
$holdnew->execute|| die "Sorry Kanree!!";
while(@row=$holdnew->fetchrow_array)
{print("\n@row\n");}

#end of the code:)

Have a easy learning!!:)

Thursday, August 13, 2009

C continued...

Ok..

Hello world...!!! A start of every program..

main()
{
printf ("Hello");
getch();
}

Is this much is enough.. I hope so..
Let me checkk...
Hey it is working yaar........
Good

C continued..

Let me note down what I know...

C is a structured language..
Fine..
It is well structured...
It has got a sequential flow...
Nice...

It starts from main program and ends within the main program.. (I have some doubts about the end part of the last sentence)

In windows plattform to work with C better to install turbo C.
It is an IDE.

I know if I write a program in this IDE and say CTRL+F9 it will run compile and run my program..
Good..
I know so many technical stuffs are missing above but it is fine.. I assumed that I know those small things better.. and they are not worth to mention here..
Now what...
Straight in to the programming...

The legacy of C

C...
The mother of all programming languages...
It is the basic structure upon which the dream world of software has built..
I welcome myself into the learnings of C program and from today I zolt all the gnan .. the knowledge I get Out of it...