Hi,
I have always worked with DAO in VB6. Now I want to change to dotnet and
ado.
In general I don't have problems with dotnet(2003) but I need a example for
a simple database (ex: 2 fields: name and adres)
1. making the database
2. Making a table
3. Making a index
4. Making a relation
with info lines
Who can help me 6 1177
I found this one too:
Its a simple address book database using ADO: http://www.planet-source-code.com/vb...=337&lngWId=10
"JR" wrote: Hi,
I have always worked with DAO in VB6. Now I want to change to dotnet and ado.
In general I don't have problems with dotnet(2003) but I need a example for a simple database (ex: 2 fields: name and adres)
1. making the database 2. Making a table 3. Making a index 4. Making a relation
with info lines Who can help me
JR,
Beneath a sample. I changed a little bit an older sample from me.
This uses ADO for the creating of the Access database (what is not possible
using ADONET) and for the rest ADONET. The samples I have seen (not mine)
use only ADO for this kind of solutions.
The questions about making a table etc. you have in my opinion to explain,
because I have seen this can confuse. Do you mean a database datatable or a
dataset datatable in this?
Where for creating a database datatable relation etc. you would have to use
classic ADO again.
I hope this helps,
Cor
set a reference to COM adox ext 2.x for dll and security
\\\
Public Class Main
Public Shared Sub Main()
Dim catNewDB As New ADOX.Catalog
Dim fi As New IO.FileInfo("c:\db1.mdb")
If fi.Exists Then
If MessageBox.Show("Delete?", "Existing File db1.mdb", _
MessageBoxButtons.YesNo) = DialogResult.Yes Then
fi.Delete()
Else
Exit Sub
End If
End If
catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0; " & "Data
Source=C:\db1.mdb")
'To make tables we use Adonet
Dim conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLED B.4.0;" &
_
" Data Source=C:\db1.mdb;User Id=admin;Password=;")
Dim cmd As New OleDb.OleDbCommand("CREATE TABLE persons ( " & _
"AutoId int identity ," & _
"Id int NOT NULL," & _
"Name NVarchar(50)," & _
"BirthDate datetime," & _
"IdCountry int," & _
"CONSTRAINT [pk_AutoId] PRIMARY KEY (AutoId)) ", conn)
conn.Open()
Try
cmd.ExecuteNonQuery()
Catch ex As OleDb.OleDbException
MessageBox.Show(ex.Message, "OleDbException")
Exit Sub
Catch ex As Exception
MessageBox.Show(ex.Message, "GeneralException")
Exit Sub
End Try
conn.Close()
End Sub
End Class
////
Pleace Help
"JR" <XX***@xx.xx> schreef in bericht
news:PW*********************@phobos.telenet-ops.be... Hi,
I have always worked with DAO in VB6. Now I want to change to dotnet and ado.
In general I don't have problems with dotnet(2003) but I need a example for a simple database (ex: 2 fields: name and adres)
1. making the database 2. Making a table 3. Making a index 4. Making a relation
with info lines Who can help me
thanks all
Jan
"Cor Ligthert" <no************@planet.nl> schreef in bericht
news:%2****************@TK2MSFTNGP10.phx.gbl... JR,
Beneath a sample. I changed a little bit an older sample from me. This uses ADO for the creating of the Access database (what is not possible using ADONET) and for the rest ADONET. The samples I have seen (not mine) use only ADO for this kind of solutions.
The questions about making a table etc. you have in my opinion to explain, because I have seen this can confuse. Do you mean a database datatable or a dataset datatable in this?
Where for creating a database datatable relation etc. you would have to use classic ADO again.
I hope this helps,
Cor
set a reference to COM adox ext 2.x for dll and security \\\ Public Class Main Public Shared Sub Main() Dim catNewDB As New ADOX.Catalog Dim fi As New IO.FileInfo("c:\db1.mdb") If fi.Exists Then If MessageBox.Show("Delete?", "Existing File db1.mdb", _ MessageBoxButtons.YesNo) = DialogResult.Yes Then fi.Delete() Else Exit Sub End If End If catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0; " & "Data Source=C:\db1.mdb") 'To make tables we use Adonet Dim conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLED B.4.0;" & _ " Data Source=C:\db1.mdb;User Id=admin;Password=;") Dim cmd As New OleDb.OleDbCommand("CREATE TABLE persons ( " & _ "AutoId int identity ," & _ "Id int NOT NULL," & _ "Name NVarchar(50)," & _ "BirthDate datetime," & _ "IdCountry int," & _ "CONSTRAINT [pk_AutoId] PRIMARY KEY (AutoId)) ", conn) conn.Open() Try cmd.ExecuteNonQuery() Catch ex As OleDb.OleDbException MessageBox.Show(ex.Message, "OleDbException") Exit Sub Catch ex As Exception MessageBox.Show(ex.Message, "GeneralException") Exit Sub End Try conn.Close() End Sub End Class ////
thanks all
Jan
"Cor Ligthert" <no************@planet.nl> schreef in bericht
news:%2****************@TK2MSFTNGP10.phx.gbl... JR,
Beneath a sample. I changed a little bit an older sample from me. This uses ADO for the creating of the Access database (what is not possible using ADONET) and for the rest ADONET. The samples I have seen (not mine) use only ADO for this kind of solutions.
The questions about making a table etc. you have in my opinion to explain, because I have seen this can confuse. Do you mean a database datatable or a dataset datatable in this?
Where for creating a database datatable relation etc. you would have to use classic ADO again.
I hope this helps,
Cor
set a reference to COM adox ext 2.x for dll and security \\\ Public Class Main Public Shared Sub Main() Dim catNewDB As New ADOX.Catalog Dim fi As New IO.FileInfo("c:\db1.mdb") If fi.Exists Then If MessageBox.Show("Delete?", "Existing File db1.mdb", _ MessageBoxButtons.YesNo) = DialogResult.Yes Then fi.Delete() Else Exit Sub End If End If catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0; " & "Data Source=C:\db1.mdb") 'To make tables we use Adonet Dim conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLED B.4.0;" & _ " Data Source=C:\db1.mdb;User Id=admin;Password=;") Dim cmd As New OleDb.OleDbCommand("CREATE TABLE persons ( " & _ "AutoId int identity ," & _ "Id int NOT NULL," & _ "Name NVarchar(50)," & _ "BirthDate datetime," & _ "IdCountry int," & _ "CONSTRAINT [pk_AutoId] PRIMARY KEY (AutoId)) ", conn) conn.Open() Try cmd.ExecuteNonQuery() Catch ex As OleDb.OleDbException MessageBox.Show(ex.Message, "OleDbException") Exit Sub Catch ex As Exception MessageBox.Show(ex.Message, "GeneralException") Exit Sub End Try conn.Close() End Sub End Class //// This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael Foord |
last post by:
#!/usr/bin/python -u
# 15-09-04
# v1.0.0
# auth_example.py
# A simple script manually demonstrating basic authentication.
# Copyright Michael Foord
# Free to use, modify and relicense.
#...
|
by: Ville Vainio |
last post by:
Just posting this for the sake of google:
Like everyone else, I figured it's time to start using the 'logging'
module.
I typically want to dump "info" level (and up) log information to...
|
by: relaxedrob |
last post by:
Hi All!
I ran the following w3c example through my WSDL parser (SOA Editor
from Cape Clear):
http://www.w3.org/TR/wsdl#_rpcexample
It told me that there were a bunch of erros about no...
|
by: Bo Xu |
last post by:
Object of Combination
By Bo Xu
Introduction
A combination of n things, taken s at a time, often referred as an
s-combination out of n, is a way to select a subset of size s from a
given set of...
|
by: Xah Lee |
last post by:
Python Doc Problem Example: gzip
Xah Lee, 20050831
Today i need to use Python to compress/decompress gzip files. Since
i've read the official Python tutorial 8 months ago, have spent 30...
|
by: ajikoe |
last post by:
Hello,
I used Visual C# Standard Edition.
I want to comment my program using xml commentary method,
I don't know why if I use value and example tag, it is not working / showed in the html...
|
by: cj |
last post by:
Lets just take this example I'm looking at now. I'm looking at the help
screen titled .NET Framework Class Library FolderBrowserDialog Class
. It gives an example at the bottom that begins with:...
|
by: Scott M. |
last post by:
Where will code that is preceded with:
/// <example>
/// some comments
/// </example>
actually show up?
I can see my <summaryand <remarkscode showing up in the code comment
pages and in...
|
by: meltedown |
last post by:
This is supposed ot be an example:
http://www.ajaxtutorial.net/index.php/2006/11/30/simple-ajax-using-prototype-part-2/
It says :
This example is probably the simplest example you will ever...
|
by: Guy Macon |
last post by:
While I agree with the sentiment, the oringinal title on this thread
("OT: Specially for , why you should always use example.com
for obfuscating domains") is wrong. There are other reserved domain...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |