473,394 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Create Table in SQL server (Visual basic.Net )

Ben
Hi everyone,

Now I am using Visual Basic.net to write a program but having some
headaches. The situation is as follows:

I am using ODBC connection to connect one database( non-SQL server) , which
has over 20 tables and each table has lot of fields. My aim is to setup a
button, everytime when the button is clicked, the selected tables through
the ODBC connection will be copied to a SQL server 2000 ( Both the data and
table structure), which means a table will be created on SQL server and all
the data will be inserted accordingly. If the created table has already
existed on the SQL server 2000, a drop action will be done before creating.

Is there a simplest way to fulfill above aim in Visual Basic code? I am
trying to use SQL-DMO , but it is too tedious as I need to write the code to
setup each table structure and insert the data , which is too tedious .

Thanks in advanced.
Ben

Nov 22 '05 #1
3 3432
You could try to generalize by creatingh the target tables by inspecting the
source tables.

This way you'll be ablt to use the same code for all tables (do you hardcode
for now the structure for each table ?)

Patrice

--

"Ben" <Be*@discussions.microsoft.com> a écrit dans le message de
news:21**********************************@microsof t.com...
Hi everyone,

Now I am using Visual Basic.net to write a program but having some
headaches. The situation is as follows:

I am using ODBC connection to connect one database( non-SQL server) , which has over 20 tables and each table has lot of fields. My aim is to setup a button, everytime when the button is clicked, the selected tables through
the ODBC connection will be copied to a SQL server 2000 ( Both the data and table structure), which means a table will be created on SQL server and all the data will be inserted accordingly. If the created table has already
existed on the SQL server 2000, a drop action will be done before creating.
Is there a simplest way to fulfill above aim in Visual Basic code? I am
trying to use SQL-DMO , but it is too tedious as I need to write the code to setup each table structure and insert the data , which is too tedious .

Thanks in advanced.
Ben

Nov 22 '05 #2
Ben
Hi Patrice,

Thanks for your reponse. I haven't started the code for each table yet . And
still looking for a better way . But it will be a really tough job to
create the structure table by table in code.

"Patrice" wrote:
You could try to generalize by creatingh the target tables by inspecting the
source tables.

This way you'll be ablt to use the same code for all tables (do you hardcode
for now the structure for each table ?)

Patrice

--

"Ben" <Be*@discussions.microsoft.com> a écrit dans le message de
news:21**********************************@microsof t.com...
Hi everyone,

Now I am using Visual Basic.net to write a program but having some
headaches. The situation is as follows:

I am using ODBC connection to connect one database( non-SQL server) ,

which
has over 20 tables and each table has lot of fields. My aim is to setup

a
button, everytime when the button is clicked, the selected tables through
the ODBC connection will be copied to a SQL server 2000 ( Both the data

and
table structure), which means a table will be created on SQL server and

all
the data will be inserted accordingly. If the created table has already
existed on the SQL server 2000, a drop action will be done before

creating.

Is there a simplest way to fulfill above aim in Visual Basic code? I am
trying to use SQL-DMO , but it is too tedious as I need to write the code

to
setup each table structure and insert the data , which is too tedious .

Thanks in advanced.
Ben


Nov 22 '05 #3
"Table by table" ? I meant the program could just inspect the source table
and create "automatically" the target table. Once done you'll just have to
call the same code for each table.

If you don't want to do that in VB.NET code you could :
- use SELECT INTO, it will create the target table and will fill. You 'll
likely still have though to add some more "details" (such as FK)
- if the structure is fixed you could use a "model" file or a SQL script to
create the DB

It's a bit hard to suggest something as I don"t really see what are your
requirements...

Patrice

--

"Ben" <Be*@discussions.microsoft.com> a écrit dans le message de
news:6C**********************************@microsof t.com...
Hi Patrice,

Thanks for your reponse. I haven't started the code for each table yet . And still looking for a better way . But it will be a really tough job to
create the structure table by table in code.

"Patrice" wrote:
You could try to generalize by creatingh the target tables by inspecting the source tables.

This way you'll be ablt to use the same code for all tables (do you hardcode for now the structure for each table ?)

Patrice

--

"Ben" <Be*@discussions.microsoft.com> a écrit dans le message de
news:21**********************************@microsof t.com...
Hi everyone,

Now I am using Visual Basic.net to write a program but having some
headaches. The situation is as follows:

I am using ODBC connection to connect one database( non-SQL server) ,

which
has over 20 tables and each table has lot of fields. My aim is to setup
a
button, everytime when the button is clicked, the selected tables
through the ODBC connection will be copied to a SQL server 2000 ( Both the data and
table structure), which means a table will be created on SQL server
and all
the data will be inserted accordingly. If the created table has
already existed on the SQL server 2000, a drop action will be done before

creating.

Is there a simplest way to fulfill above aim in Visual Basic code? I am trying to use SQL-DMO , but it is too tedious as I need to write the code to
setup each table structure and insert the data , which is too tedious

..
Thanks in advanced.
Ben


Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ben | last post by:
Hi everyone, Now I am using Visual Basic.net to write a program but having some headaches. The situation is as follows: I am using ODBC connection to connect one database( non-SQL server) ,...
5
by: Roy Gourgi | last post by:
Hi, I am used to working in Visual FoxPro and I would like to be able to create a database and store and retrieve information from it. What is the simplest way to do it and what should I be...
3
by: Rob Rogers | last post by:
I have an ASP.NET datagrid that loads an image. I would like to load one image if the value in my SQL table is true and another if it is false. Here is my code. <%@ Page Language="vb"...
9
by: Bob Achgill | last post by:
I would like to use the timestamp on files to manage the currency of support files for my VB windows application. In this case I would only put the timestamp of the file in the management database...
3
by: James Wong | last post by:
Dear all, I have an old VB6 application which can create and access Excel object. The basic definition statements are as follows: Dim appExcel As Object Dim wkb1 As Excel.Workbook Dim wks1...
4
by: Wayne Wengert | last post by:
I am trying to create a VB.NET Windows application to move some data from a local Access DB table to a table in a SQL Server. The approach I am trying is to open an OLEDB connection to the local...
11
by: mesut demir | last post by:
Hi All, When I create fields (in files) I need assign a data type like char, varchar, money etc. I have some questions about the data types when you create fields in a file. What is the...
11
by: raylopez99 | last post by:
Keep in mind this is my first compiled SQL program Stored Procedure (SP), copied from a book by Frasier Visual C++.NET in Visual Studio 2005 (Chap12). So far, so theory, except for one bug...
0
by: mchirouze | last post by:
Hi ! I'm trying build a tool that pre-processes an Access database and then exports the results to a SQL Server database. I find it easier to work with SQL queries than to do line-by-line...
11
by: =?Utf-8?B?UGV0ZXIgSw==?= | last post by:
I am working with Visual Studio or alternately with Expression Web. I need to create about 50 aspx pages with about 1200 thumbnali images, typically arranged in three to four groups per page,...
0
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.