ASP.Net Database Connection

by Shabbir on May 2, 2008

in ASP.Net

In the previous two articles (1, 2) we explained connecting to Microsoft Access database and writing to it, in C#.

Now we do that in ASP.Net.

For start create a new ASP.Net project. First of all we are creating two labels, two text boxes and one button with the following code (add it between the <div></div> tags)

 

So, lets define the event which is invoked by clicking on the button (add it above html tag)

<script><!--mce:0--></script>

When we run the script on ASP server we will get the following page

ASP page connecting to database

By clicking the button is invoked the button1_Click event and then the data written in the text boxes is recorded to database.

Sharing is Caring...

Other Related Posts:

  1. Creating a Database Connection
  2. Simple Data Entry In Microsoft Access Database
  3. ASP.Net Web Site Sample
  4. Creating a Windows Forms Application in C#
  5. Adding Items to ListView Control

{ 7 comments… read them below or add one }

matma May 11, 2008 at 5:19 pm

Your blog is fine for people, who writes their first programs, I think. But in this example You schould use String.Format, or even StringBuilder class, because hard coded strings is the worst thing in applications like above. Do not teach other to write code like that.

Anyway, keep up to good work.

Reply

admin May 12, 2008 at 7:53 pm

Thanks for your suggestion. You’re right, the String.Format or StringBuilder class is good when working with strings.
But, because this blog is for beginners I want to explain that as simple as possible.
In the next posts I will explain the use of String and StringBuilder classes.
So, step by step.

Reply

George Lindemann Jr May 28, 2008 at 10:39 am

i am looking for same basic programming tips in asp.net and i found your blog.
Thanks for the post

Reply

Fahim June 2, 2008 at 7:01 am

well i saw your Blog its good for first level guy who is new in the hevaen of Programming…..u gave grate subtitute to use the control…hope u will post more and more…..i appreciate.

Reply

.net development June 29, 2009 at 7:50 am

Great Article! Thanks for sharing very useful database connection. It will help me a lot.

Reply

roulette game downloads July 9, 2009 at 1:56 pm

Awesome. just awesome…i haven’t any word to appreciate this post…..Really i am impressed from this post….the person who create this post he is a great human..thanks for shared this with us.i found this informative and interesting blog so i think so its very useful and knowledge able.I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me.Really the blogging is spreading its wings rapidly…

Reply

matma September 27, 2009 at 4:37 am

Your blog is fine for people, who writes their first programs, I think. But in this example You schould use String.Format, or even StringBuilder class, because hard coded strings is the worst thing in applications like above. Do not teach other to write code like that.

Anyway, keep up to good work.

Reply

Leave a Comment

Spam protection by WP Captcha-Free

Previous post:

Next post:

    About the Author

  • author photo

    My Name is Shabbir Bhimani and I am developer by profession in the field of applications, web and database. Currently doing full time online marketing and like to share my experiences on how you can make money online @ CodeItWell.com. Read more ...


    See how you can get in touch with me.