I am doing customization for Microsoft Pos. I am working on
installation package now. I added some new tables and stored
procuedures and generated SQL Script for that. During the installation
process, after user entered the server name and database name, how to
open the script file (*.sql) and run that to update database? So they
don't have to open Query Analizer to run it. The idea is to get
everything done during the installation process. Anyone got an idea?
Thanks in advance.
Leanne 5 2089
Leanne,
You can run every script using the SQLCommand.executenonquery, therefore as
well Create and Alter statements. http://msdn2.microsoft.com/en-us/lib...enonquery.aspx
I hope this helps,
Cor
"Leanne" <le******@connectretail.com.auschreef in bericht
news:11**********************@f16g2000cwb.googlegr oups.com...
>I am doing customization for Microsoft Pos. I am working on
installation package now. I added some new tables and stored
procuedures and generated SQL Script for that. During the installation
process, after user entered the server name and database name, how to
open the script file (*.sql) and run that to update database? So they
don't have to open Query Analizer to run it. The idea is to get
everything done during the installation process. Anyone got an idea?
Thanks in advance.
Leanne
Cor,
Thank you for your reply. My problem is, the generated SQL script
contains a lot " if exist...then drop...Go..." etc, so when I use
ls=My.Computer.FileSystem.ReadAllText(Dialog1.File Name)
sqlCommand.CommandText = ls
sqlCommand.ExecuteNonQuery()
I got many syntex error. (such as "Go" should be the last). I set the
command type to "text". I don't know what method I should use to read
string from the file and how should I tell sqlCommand that this is SQL
Script and not normal SQL Statement.
Thanks again
Leanne
Cor Ligthert [MVP] wrote:
Leanne,
You can run every script using the SQLCommand.executenonquery, therefore as
well Create and Alter statements.
http://msdn2.microsoft.com/en-us/lib...enonquery.aspx
I hope this helps,
Cor
"Leanne" <le******@connectretail.com.auschreef in bericht
news:11**********************@f16g2000cwb.googlegr oups.com...
I am doing customization for Microsoft Pos. I am working on
installation package now. I added some new tables and stored
procuedures and generated SQL Script for that. During the installation
process, after user entered the server name and database name, how to
open the script file (*.sql) and run that to update database? So they
don't have to open Query Analizer to run it. The idea is to get
everything done during the installation process. Anyone got an idea?
Thanks in advance.
Leanne
Leanne,
Did you look at the code in the Query analyzer from the SQL management tool,
if you start with a new one, than that starts with statements to let it
execute to be imported in the program libraries of SQL server.
Cor
"Leanne" <le******@connectretail.com.auschreef in bericht
news:11*********************@h48g2000cwc.googlegro ups.com...
Cor,
Thank you for your reply. My problem is, the generated SQL script
contains a lot " if exist...then drop...Go..." etc, so when I use
ls=My.Computer.FileSystem.ReadAllText(Dialog1.File Name)
sqlCommand.CommandText = ls
sqlCommand.ExecuteNonQuery()
I got many syntex error. (such as "Go" should be the last). I set the
command type to "text". I don't know what method I should use to read
string from the file and how should I tell sqlCommand that this is SQL
Script and not normal SQL Statement.
Thanks again
Leanne
Cor Ligthert [MVP] wrote:
>Leanne,
You can run every script using the SQLCommand.executenonquery, therefore as well Create and Alter statements.
http://msdn2.microsoft.com/en-us/lib...enonquery.aspx
I hope this helps,
Cor
"Leanne" <le******@connectretail.com.auschreef in bericht news:11**********************@f16g2000cwb.googleg roups.com...
>I am doing customization for Microsoft Pos. I am working on
installation package now. I added some new tables and stored
procuedures and generated SQL Script for that. During the installation
process, after user entered the server name and database name, how to
open the script file (*.sql) and run that to update database? So they
don't have to open Query Analizer to run it. The idea is to get
everything done during the installation process. Anyone got an idea?
Thanks in advance.
Leanne
Cor,
If I start Query analyzer, then open the sql file, I can run that
without any problem.
Now what I want is to open the sql file from VB, and then execute that
throuth sqlCommand. Can you tell me how to do that? Some code sample
maybe?
Thanks
Leanne
Cor Ligthert [MVP] wrote:
Leanne,
Did you look at the code in the Query analyzer from the SQL management tool,
if you start with a new one, than that starts with statements to let it
execute to be imported in the program libraries of SQL server.
Cor
"Leanne" <le******@connectretail.com.auschreef in bericht
news:11*********************@h48g2000cwc.googlegro ups.com...
Cor,
Thank you for your reply. My problem is, the generated SQL script
contains a lot " if exist...then drop...Go..." etc, so when I use
ls=My.Computer.FileSystem.ReadAllText(Dialog1.File Name)
sqlCommand.CommandText = ls
sqlCommand.ExecuteNonQuery()
I got many syntex error. (such as "Go" should be the last). I set the
command type to "text". I don't know what method I should use to read
string from the file and how should I tell sqlCommand that this is SQL
Script and not normal SQL Statement.
Thanks again
Leanne
Cor Ligthert [MVP] wrote:
Leanne,
You can run every script using the SQLCommand.executenonquery, therefore
as
well Create and Alter statements.
http://msdn2.microsoft.com/en-us/lib...enonquery.aspx
I hope this helps,
Cor
"Leanne" <le******@connectretail.com.auschreef in bericht
news:11**********************@f16g2000cwb.googlegr oups.com...
I am doing customization for Microsoft Pos. I am working on
installation package now. I added some new tables and stored
procuedures and generated SQL Script for that. During the installation
process, after user entered the server name and database name, how to
open the script file (*.sql) and run that to update database? So they
don't have to open Query Analizer to run it. The idea is to get
everything done during the installation process. Anyone got an idea?
Thanks in advance.
Leanne
Not tested,
cmd.CommandText = _
"CREATE PROCEDURE dbo.whatever AS & vbCrLf & _
SELECT * FROM MyTable"
cmd.ExecuteNonQuery()
If it is already in your database than CREATE is ALTER
I hope this helps,
Cor
"Leanne" <le******@connectretail.com.auschreef in bericht
news:11**********************@i42g2000cwa.googlegr oups.com...
Cor,
If I start Query analyzer, then open the sql file, I can run that
without any problem.
Now what I want is to open the sql file from VB, and then execute that
throuth sqlCommand. Can you tell me how to do that? Some code sample
maybe?
Thanks
Leanne
Cor Ligthert [MVP] wrote:
>Leanne,
Did you look at the code in the Query analyzer from the SQL management tool, if you start with a new one, than that starts with statements to let it execute to be imported in the program libraries of SQL server.
Cor
"Leanne" <le******@connectretail.com.auschreef in bericht news:11*********************@h48g2000cwc.googlegr oups.com...
Cor,
Thank you for your reply. My problem is, the generated SQL script
contains a lot " if exist...then drop...Go..." etc, so when I use
ls=My.Computer.FileSystem.ReadAllText(Dialog1.File Name)
sqlCommand.CommandText = ls
sqlCommand.ExecuteNonQuery()
I got many syntex error. (such as "Go" should be the last). I set the
command type to "text". I don't know what method I should use to read
string from the file and how should I tell sqlCommand that this is SQL
Script and not normal SQL Statement.
Thanks again
Leanne
Cor Ligthert [MVP] wrote: Leanne,
You can run every script using the SQLCommand.executenonquery, therefore as well Create and Alter statements.
http://msdn2.microsoft.com/en-us/lib...enonquery.aspx
I hope this helps,
Cor
"Leanne" <le******@connectretail.com.auschreef in bericht news:11**********************@f16g2000cwb.googleg roups.com... I am doing customization for Microsoft Pos. I am working on
installation package now. I added some new tables and stored
procuedures and generated SQL Script for that. During the
installation
process, after user entered the server name and database name, how
to
open the script file (*.sql) and run that to update database? So
they
don't have to open Query Analizer to run it. The idea is to get
everything done during the installation process. Anyone got an idea?
Thanks in advance.
Leanne
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mark |
last post by:
A beginner in this area, I have been able to read a record from a
MySQL database and populate an HTML form (wow!). Now, my goal is to
allow the user to edit the contents of the form and then...
|
by: Jim |
last post by:
Hi,
Let me explain how I'd generally do things. For a page where the user
edits data, I'd generally call it something like editfred.php (for
example), the page which updates the data would be...
|
by: Lyners |
last post by:
I have a web page writen in ASP.NET that contains some javascript so that
when a user presses a button, or edits a certain field in a datagrid, another
cell in the datagrid is filled with a value....
|
by: Jonathan Upright |
last post by:
Greetings to anyone who can help:
I'm using WebMatrix to make ASP.NET pages, and I chose the "Editable
DataGrid" at the project selector screen. As you may know, it defaults
to the Microsoft...
|
by: Ian Davies |
last post by:
Hello
Needing help with a suitable solution.
I have extracted records into a table under three columns 'category',
'comment' and share (the category column also holds the index no of the
record...
|
by: Jim in Arizona |
last post by:
I'm experimenting by following instructions at this address:
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/datalist.aspx
on how to use the DataList.
I was trying out the...
|
by: rukkie |
last post by:
Hi,
I have a dynamic HTML page with 4 columns of data, retrieved with PHP
from a MySQL database.
At the end of every row I have an UPDATE submit button, which activates
a php update script to...
|
by: keeps21 |
last post by:
A little problem I've run into is the following.
I have a script that allows a user to edit a story.
I have an HTML form for title and main_text which gets it's values by pulling the selected...
|
by: DavidPr |
last post by:
I've wrestled with this code all day and I just can't figure out what the problem is.
I have this same code on the add_job.php page and the edit_job.php page and neither one is enter in the correct...
|
by: Jarosław Kozik |
last post by:
how to create script - update database development code using MSSQL 2000
Enterprise Manager
i'm trying in this way
all tasks -genetate sql script .... ( in this way I can generate only
CREATE...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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: 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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |