String = “val1, val2, va3, va4”
Insert value into col1 (String)
I am looking for an example of an insert statement that parses a string with
multi values separated by a comma. I want to parse these values and put one
Value, per row, into the same column.
Thanks
BrianDH 7 8884
Do you want to use a stored procedure? Otherwise you will need to parse it
in VB code and send in multiple insert statements. (At least I know of no
other way)
Chris
"BrianDH" <Br*****@discus sions.microsoft .com> wrote in message
news:55******** *************** ***********@mic rosoft.com... String = "val1, val2, va3, va4" Insert value into col1 (String)
I am looking for an example of an insert statement that parses a string with multi values separated by a comma. I want to parse these values and put one Value, per row, into the same column.
Thanks
BrianDH
This is a one time deal. We have a string in a web form of about 45 email
address. what I want to do is parse the sting into a new table and stop
using this string and start managing these via the DB.
So yes use VB code.
"Chris, Master of All Things Insignifican" wrote: Do you want to use a stored procedure? Otherwise you will need to parse it in VB code and send in multiple insert statements. (At least I know of no other way)
Chris
"BrianDH" <Br*****@discus sions.microsoft .com> wrote in message news:55******** *************** ***********@mic rosoft.com... String = "val1, val2, va3, va4" Insert value into col1 (String)
I am looking for an example of an insert statement that parses a string with multi values separated by a comma. I want to parse these values and put one Value, per row, into the same column.
Thanks
BrianDH
Use the String.Split(", ") to break them up into an array. Then loop through
and insert them into the DB one by one.
Chris
"BrianDH" <Br*****@discus sions.microsoft .com> wrote in message
news:5C******** *************** ***********@mic rosoft.com... This is a one time deal. We have a string in a web form of about 45 email address. what I want to do is parse the sting into a new table and stop using this string and start managing these via the DB.
So yes use VB code.
"Chris, Master of All Things Insignifican" wrote:
Do you want to use a stored procedure? Otherwise you will need to parse it in VB code and send in multiple insert statements. (At least I know of no other way)
Chris
"BrianDH" <Br*****@discus sions.microsoft .com> wrote in message news:55******** *************** ***********@mic rosoft.com... > String = "val1, val2, va3, va4" > Insert value into col1 (String) > > I am looking for an example of an insert statement that parses a string > with > multi values separated by a comma. I want to parse these values and > put > one > Value, per row, into the same column. > > Thanks > > BrianDH >
BrianDH,
And what is the problem?
Cor
Done!
Dim emailString As String = "val1, val2, val3, val4, val5"
Dim srString() = Split(emailStri ng, ";")
Dim intCount As Integer = srString.Length
Dim X As Integer = 0
Dim myCommand As New SqlCommand
Dim myTrans As SqlTransaction
Dim myConnString As String =
"Server=Server; Database=Databa se;UID=;PWD=;"
Dim myConnection As New SqlConnection(m yConnString)
'Open connection
myConnection.Op en()
' Start Transaction
myTrans = myConnection.Be ginTransaction( )
myCommand.Conne ction = myConnection
myCommand.Trans action = myTrans
Do Until X = intCount
myCommand.Comma ndText = "Insert into TableName (EmailAddress)
VALUES ('" & srString(X) & "')"
myCommand.Execu teNonQuery()
X = X + 1
Loop
' Commit transaction
myTrans.Commit( )
' Close Connection
myConnection.Cl ose()
"BrianDH" wrote: String = “val1, val2, va3, va4” Insert value into col1 (String)
I am looking for an example of an insert statement that parses a string with multi values separated by a comma. I want to parse these values and put one Value, per row, into the same column.
Thanks
BrianDH
And Brian,
What was the reason (problem) in this I asked that you have sent the
question?
It are more classes which are used, so which one did give you problems?
Cor
Complete humbug typing
That you have sent the message = Why you have sent the message This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Arne |
last post by:
From: "Arne de Booij" <a_de_booij@hotmail.com>
Subject: Comma delimited array into DB problems
Date: 9. februar 2004 10:39
Hi,
I have an asp page that takes input from a form on the previous page,
puts that into an array and inserts the array into SQL server.
Now here is the problem:
|
by: Larry Williams |
last post by:
Is there an easy way to convert a string of data to XML format without having
to create the xml one field at a time?
Sorry I'm a newbie and my xml knowledge is limited. I have tried to search
through the documentation in .net but nothing jumps out at me.
Sample code would be great!
|
by: Wayne |
last post by:
I have the following string:
"smith", "Joe", "West Palm Beach, Fl."
I need to split this string based on the commas, but as you see the city
state contains a comma. String.split will spilt the city state. Is there a
built in function that I'm missing that will do the split and recognize that
the comma in city state is part of the item?
--
|
by: hazz |
last post by:
yes i should know this but ...
V,-1,1,2,-1,333,5
I would like to return the value from any position within the comma
delimited string
position 1 is "v"
position 2 is "-1"
position 6 is "333"
|
by: rn5a |
last post by:
A MS_Access DB table has 3 columns - ID, UID & Location. ID is an
AutoNumber column, UID is a foreign key (the primary key UID column
resides in another table). Each UID can have multiple entries under
the Location column something like this:
---------------------------
UID Location
---------------------------
2 China
2 Japan
| |
by: Frank Jovi |
last post by:
I am working on a website with ASP.NET 2.0
I started with a SQL database .mdf. After further discussions with my client, we decided to switch to an Access database.
I created a Select query that has a parameter that is a comma delimited string brought in through a paramater in to the <selectcommand=...>
The query worked perfectly before, but I ran into a problem in the switch over because:
WHERE charindex(',' + CustomerID + ',', ','...
|
by: pieandpeas |
last post by:
Hi
I have a string e g. "Address1,Address2,Address3,Town,Zip" of multiple lines, quite like a database table.. i need to export this to a CSV file, i've heard examples of using a filescript object to do this.. but i'm not sure the best way
could someone help me with some code please
|
by: vishakha209 |
last post by:
I want to use comma delimited string as an input for stored procedure. how to delimit the string and access the values? can anybody help ....
|
by: Shelby Poston |
last post by:
I created table controls and loop through table control row
public virtual void Button_Click(object sender, EventArgs args)
{
RegistrationTableControl recControls = (RegistrationTableControl)this.Page.FindControlRecursively("RegistrationTableControl");
if (recControls != null)
{
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 projectplanning, coding, testing, and deploymentwithout 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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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
| |