Database Application

Submitted by: 
Visitors have accessed this post 14940 times.

this is just a simple database query developed during my lunch break =)
hope u like it =)


Tags: 

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Comments

can u please teach me how to work with ado in my program??/

activex design object :) sa VB ba? kasi pwede rin ADO sa .net

sir cedrick, i kinda like your post, it fits on my current project.. i am new in VB.net and still studying it. i quoted the code here:

rs = New ADODB.Recordset
rs.Open("Select * from administrator", cnstring, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)

rs.AddNew()
rs("username").Value = txtusername.Text
rs("password").Value = txtpassword.Text
rs.Update()

MsgBox("Save!", MsgBoxStyle.Information, "Save")
txtpassword.Text = ""
txtusername.Text = ""

gridview1.Refresh()

i just want to ask what is the meaning of this line:

rs = New ADODB.Recordset
rs.Open("Select * from administrator", cnstring, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)

thanks alot!

i just transferd mah code in vb 6 to .net
but anyways...

in this line

rs = New ADODB.Recordset
rs.Open("Select * from administrator", cnstring, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)

the recordset open and select what table(administrator table) to be used =)

woe tnx sir for the comment =)
but i prefared using recordset in inserting records but anyways this is just an example of my work. Yes, thanks for the info that OleDbCommand parameters reduce SQL injection attacks. Im just new hir so I need your help in programming =)

i agreed with sir arjay..

Happy new year

I have reviewed your code.
It's nice but there is a problem with interacting COM objects with .NET objects.

In your example, you interopped Microsoft ActiveX DataObjects with your .NET application. Microsoft ActiveX Data Object is a COM library.

As we all know, much of the previous COM implementations (VB6, VC++6 etc) had been replaced or updated when .NET was introduced.

So instead of creating an ADODB.Recordset object for Inserting new records,
you can just use OleDbCommand to the the record insertion.

Example:

Using cmd as New OleDbCommand
cmd.Connection = conn
cmd.CommandText = "Insert into table SET column [email protected]"
cmd.Parameters.Add("@value", OleDbType.Varchar).Value = value
cmd.ExecuteNonQuery()
End Using

Also using OleDbCommand parameters reduce SQL injection attacks, which makes your application safer.

Although COM and .NET interop is possible, for optimization, if it is possible in .NET, do it in .NET.

i agreed with you bro..
we can use dis instead of adodb.recordset.
for me, i prefer, odbcconnection than oledbconnection
for example..
import system.data.odbc

Dim myconnection = New System.Data.Odbc.OdbcConnection("dsn=SampleDatabase")
dim myRecordset as new odbcConnection

with myRecordset
.connection=myconnection
.commandText="Insert into tblname(Fname)values(''"& txtFname.text &"')
.executeNonQuery()
End with

thats it!So simple..No need of any adds-on References.hehe
GodBless

Consultant / .Net Developer

::[email protected]::

+09059769698

actually ur both correct guys.. where in vb.net so well gonna use ADO.net

ill just post this code because some user ask me ho to use ADO (ADODB.recordset) in inserting records.. so this was just a help =) hehehe

soon ill post my latest project =) Quiz Bee system

where is your quiz bee system?is it vb.net 2010 and ms access? is it server and client? coz i need something like that :)

margarette laroa

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.