Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a TextBox with Array displayed in it (few lines of information).

Now I need to take each separate line of my info from this TextBox and make each separate line as a string, so I can insert it into SQL Database.

How can I do that?

 

Please help, I need it done urgently..:(

Posted

I tried Lines property, it didn't work for me..

On the other hand this array forks just fine.

All I need is to get Value(which is text array from textbox) and put it into my StoredProcedure Value.

It seems so easy but doesn't work.

I come up with things like "..must implement IConvertible"

"Index is outside of bounds of the array"

or data from the textbox gets truncated on the way and it inserts empty line.......

Posted

cmd1.Parameters.Add("@1par", SqlDbType.VarChar, 200)

cmd1.Parameters("@1par").Value = ??

 

cmd1.Parameters.Add("@2par", SqlDbType.VarChar, 200)

cmd1.Parameters("@2par").Value = ??

 

cmd1.Parameters.Add("@3par", SqlDbType.VarChar, 200)

cmd1.Parameters("@3par").Value = ??

 

 

Those question marks, I don't know what to put insted of them..

I have to get the values from my Array, which is inside the textBox already

Posted

Yes, 3 parameters

There are also 3 TextBoxes, each one has text for each parameter.

But .. every time I run my App, those TextBoxes get different ammount of text in them. Each TextBox has few lines of text in it

Posted
..........

Dim oRegex As Regex

Dim oRegex1 As Regex

Dim oRegex2 As Regex

Dim omatch As Match

Dim omatch1 As Match

Dim omatch2 As Match

Dim omatches As MatchCollection

Dim omatches1 As MatchCollection

Dim omatches2 As MatchCollection

Dim reg As String

Dim reg1 As String

Dim reg2 As String

reg = "((https?|ftp)\://((\[?(\d{1,3}\.){3}\d{1,3}\]?)|(([-a-zA-Z0-9]+\.)+[a-zA-Z]{2,4}))(\:\d+)?(/[-a-zA-Z0-9._?,'+&%$#=~\\]+)*/?)"

reg1 = "[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}"

reg2 = txtMeta.Text

 

oRegex = New Regex(reg)

oRegex1 = New Regex(reg1)

oRegex2 = New Regex(reg2)

 

Dim sContent

sContent = txtHTML.Text

 

omatches = oRegex.Matches(sContent)

omatches1 = oRegex1.Matches(sContent)

omatches2 = oRegex2.Matches(sContent)

 

For Each omatch In omatches 'Displays URL's

txtHTTP.Text = txtHTTP.Text & vbCrLf & "" & vbCrLf & omatch.Value

Next

 

For Each omatch1 In omatches1 'Displays Emails

txtEmails.Text = txtEmails.Text & vbCrLf & "" & vbCrLf & omatch1.Value

Next

 

For Each omatch2 In omatches2 'Displays MetaData

txtMetares.Text = txtMetares.Text & vbCrLf & "" & vbCrLf & omatch2.Value

Next

 

'1 Array

Dim arurl As String() = Split(txtHTTP.Text, " ")

Dim I1 As Integer

For I1 = 0 To arurl.GetUpperBound(0)

txtArrays1.Text = (arurl(I1))

Next

 

'2 Array

Dim aremail As String() = Split(txtEmails.Text, " ")

Dim I As Integer

For I = 0 To aremail.GetUpperBound(0)

txtArrays.Text = (aremail(I))

Next

 

'3 Array

Dim armeta As String() = Split(txtMetares.Text, txtMeta.Text)

Dim I2 As Integer

For I2 = 0 To armeta.GetUpperBound(0)

txtArrays2.Text = (armeta(I2))

Next

 

 

''RUN SQL SP

Try

Dim oSQLConn1 As New SqlConnection("Data Source=COMPUTER;" & _

"Initial Catalog=localDB;" & _

"Integrated Security=SSPI")

 

Dim cmd1 As New SqlCommand("mySP", oSQLConn1)

cmd1.CommandType = CommandType.StoredProcedure

oSQLConn1.Open()

Dim sdr1 As SqlDataReader

 

cmd1.Parameters.Add("@addurl", SqlDbType.VarChar, 200)

cmd1.Parameters("@addurl").Value = ??

 

cmd1.Parameters.Add("@addemail", SqlDbType.VarChar, 200)

cmd1.Parameters("@addemail").Value = ??

 

cmd1.Parameters.Add("@meta", SqlDbType.VarChar, 200)

cmd1.Parameters("@meta").Value = ??

 

sdr1 = cmd1.ExecuteReader

 

Catch ex1 As System.Exception

MsgBox(ex1.ToString())

 

Catch ex As System.Data.SqlClient.SqlException

MsgBox(ex.ToString())

 

Finally

 

End Try

 

I just need those values from TextBoxes (txtArrays1, txtArrays, txtArrays2)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...