Hi,
Is there a way to store an SQL script into a resource
file, the script contains a lot of lines, and then to
read it during run-time into a string?
Thanks, 10 2951
Hi Shai Is there a way to store an SQL script into a resource file, the script contains a lot of lines, and then to read it during run-time into a string?
Why not,
Or do you mean what is the best way, I think there is no best way, that
depends in what kind of environment you want to use it.
If you tell that a little more, than maybe we can help you?
Cor
* "Shai Goldberg" <gs***@shamir.c o.il> scripsit: Is there a way to store an SQL script into a resource file, the script contains a lot of lines, and then to read it during run-time into a string?
Add the file to the project, set its 'Build Action' to 'Embedded
Resource', then:
\\\
Imports System.IO
..
..
..
Dim f As Stream =
System.Reflecti on.Assembly.Get EntryAssembly() .GetManifestRes ourceStream( _
"<Name of the root namespace>.test .txt" _
)
Dim st As New StreamReader(f) , s As String
s = st.ReadToEnd()
MsgBox(s)
///
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Hi,
I need to add a text file into a source file and to be
able to read it during run time using VB.NET
I want to know if there is a way to do so using the
VS.NET IDE and VB.NET that is to insert into a source
file a bunch of text lines that I can read into a string
during run time.
Thanks, -----Original Message----- Hi Shai
Is there a way to store an SQL script into a resource file, the script contains a lot of lines, and then to read it during run-time into a string? Why not,
Or do you mean what is the best way, I think there is no
best way, thatdepends in what kind of environment you want to use it.
If you tell that a little more, than maybe we can help
you? Cor
.
Hi Shai,
I saw you did get some answers in this thread if that does not fit, message
again OK?
Cor I need to add a text file into a source file and to be able to read it during run time using VB.NET
I want to know if there is a way to do so using the VS.NET IDE and VB.NET that is to insert into a source file a bunch of text lines that I can read into a string during run time.
"Shai Goldberg" <gs***@shamir.c o.il> wrote in news:057201c3cd 49$29ca5b20
$a*******@phx.g bl: Hi,
Is there a way to store an SQL script into a resource file, the script contains a lot of lines, and then to read it during run-time into a string?
Thanks,
Hi,
You can use streamreader function to read the sql text, and after that can
you make a split on 'GO'. after that can you execute the the different
parts in the script. (you can not execute the hole script including GO,
because it isnt allowed)
Thomas
Hi Shai,
I saw you other message, the most easiest way is to make a dataset,
I made some examples below. I did not make in the IDE so it is probably with
errors.
I think this wil fits your problem?
Cor
\\\\
dim ds as new dataset
if file.exist ("c:\test1\test xml.xml") then
ds.ReadXml("c:\ testxml.xml", XmlReadMode.Rea dSchema)
Dim dr As DataRow = ds.Tables(0).Ro ws.Find("mynumb er")
if not dr Is Nothing Then
mySQLstring = dr.item("mySqlS tring").tostrin g
else
'errormessage
Else
'errormessage
End If
////
\\\\
To create this dataset is.
dim ds as new dataset
Dim dt As New DataTable("SqlS trings")
dt.Columns.Add( New DataColumn("myS qlStringnumber" ,
Type.GetType("S ystem.Int32")))
dt.Columns.Add( New DataColumn("myS qlString", Type.GetType("S ystem.String")) )
Dim keys(0) As DataColumn
keys(0) = dt.Columns("myS qlStringnumber" )
dt.PrimaryKey = keys
ds.Tables.Add(d t)
ds.WriteXml("c: \testxml.xml", XmlWriteMode.Wr iteSchema)
///
\\\
To add the rows you can use the normal dataset instructions for that
//// This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tom Asken |
last post by:
Hello,
i could not find information about extracting data by using
*sql_query (for me mssql_query) and do that in a way that saves server
memory.
I usually use:
$sql = "exec sp_get_GremiumsMitglieder
@foo = 'myFoo',
|
by: Rune Strand |
last post by:
What would it take to create a Firefox extension that enables Python as
a script language in the browser - just like Javascript? Is it at all
possible? Are the hundred good reasons not to bother?
I once made an application that used MozPython. It was fun and very
fast compared to the Mod_Python I eventually replaced it with. I had
to, because of all the mess updating Mozilla caused. ActiveState has a
project too . But none of these can...
|
by: Clay Beatty |
last post by:
When you create database diagrams in Enterprise Manager, the details
for constructing those diagrams is saved into the dtproperties table.
This table includes an image field which contains most of the relevant
infomation, in a binary format.
SQL Enterprise manager offers no way to script out those diagrams, so
I have created two Transact SQL components, one User Function and one
User Procedure, which together provide a means to script...
|
by: icedgar |
last post by:
am using the following script in the BeforeUpdate area of a main form.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
strMsg = "Do you wish to save your changes?"
If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?") = vbYes
Then
'do nothing
Else
|
by: ATS |
last post by:
HOWTO Extract resources from .NEt User Control and save them to file.
Please help,
I have a .NET C# User Control (derrived from
System.Windows.Forms.UserControl), and I want to embed into it large EXE
files as resources, which the User Control will extract when run, and save to
file, and then run. How can this be done?
| |
by: gorkos |
last post by:
Hi,
I am two days trying to solve a problem with some pages, which i get through
HTTPWebRequest. Error is that some pages need Script to be enabled. But how
to do this in HTTPWebRequest class?
|
by: fiefie.niles |
last post by:
I would like to save a web page to a file. When I do that, sometimes
the saved web page does not look like the original web page.
For example, when I save www.msn.com, it looks very different the
original page.
How can I save the web page to look like the original (as if I do
"File" - "Save As" and under "Save as Type" select "Web Page, complete
(*.htm,*.html)" ? Thank you.
This is how I save the web page:
Set fs =...
|
by: Daniel Marious |
last post by:
Hi,
I'm looking for a .Net/COM component which would allow a .Net programmer
with no streaming experience to be able to save online streams to local
resources (files or to DB).
I know that if I read this post I would surely think - pick up a manual and
start reading, however we have no time for this since this is one of several
demands a customer added on the last minute of a projecct.
|
by: Angus |
last post by:
I have a web page with a toolbar containing a Save button. The Save
button can change contextually to be a Search button in some cases.
Hence the button name searchsavechanges.
The snippet of html is:
<a class="searchsavechanges btn btn3d tbbtn" href="javascript:"
style="position:static">
<div id="TBsearchsavechanges">Search</div>
</a>
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |