Hi,
I have this table:
TABLENAME: ARTICLES
ID INT
DATE DATETIME
ABSTRACT VARCHAR(50)
FULLARTICLE VARCHAR(2500)
and I want to store articles text in this table. the articles are a page long, about 2500 characters max and later I want to be able to search across each article in the table and I will be using Full-Text Indexing.
I am having problems adding the articles into the database. It probably has to do with the size of text I am sending. If I try to send one line of text it works fine, but when I try to send one page of text I get empty data in the fullarticle field.
This is the procedure I use:
Public Function InsertArticle(ByVal Abstract As String, ByVal fullarticle As string) As String
Dim myConnection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("myconnectionstring"))
Dim myCommand As SqlCommand = New SqlCommand("mystoredprocedure", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
Dim parameterabstract As SqlParameter = New SqlParameter("@abstract", SqlDbType.varchar, 50)
parameterabstract.Value = abstract
myCommand.Parameters.Add(parameterabstract)
Dim parameterfullarticle As SqlParameter = New SqlParameter("@fullarticle", SqlDbType.varchar, 2500)
parameterfullarticle.Value = fullarticle
myCommand.Parameters.Add(parameterfullarticle)
' Open the connection and execute the Command
myConnection.Open()
Try
myCommand.ExecuteNonQuery()
Catch ex As Exception
response.write(ex.Message)
End Try
myConnection.Close()
End Function
Any help will be appreciated. I need to be able to retrieve the articles later and viewed in a web page that's why I was using varchar fields. Is it ok to use varchar or for the amount of text I am using should be using something else?
I have this table:
TABLENAME: ARTICLES
ID INT
DATE DATETIME
ABSTRACT VARCHAR(50)
FULLARTICLE VARCHAR(2500)
and I want to store articles text in this table. the articles are a page long, about 2500 characters max and later I want to be able to search across each article in the table and I will be using Full-Text Indexing.
I am having problems adding the articles into the database. It probably has to do with the size of text I am sending. If I try to send one line of text it works fine, but when I try to send one page of text I get empty data in the fullarticle field.
This is the procedure I use:
Public Function InsertArticle(ByVal Abstract As String, ByVal fullarticle As string) As String
Dim myConnection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("myconnectionstring"))
Dim myCommand As SqlCommand = New SqlCommand("mystoredprocedure", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
Dim parameterabstract As SqlParameter = New SqlParameter("@abstract", SqlDbType.varchar, 50)
parameterabstract.Value = abstract
myCommand.Parameters.Add(parameterabstract)
Dim parameterfullarticle As SqlParameter = New SqlParameter("@fullarticle", SqlDbType.varchar, 2500)
parameterfullarticle.Value = fullarticle
myCommand.Parameters.Add(parameterfullarticle)
' Open the connection and execute the Command
myConnection.Open()
Try
myCommand.ExecuteNonQuery()
Catch ex As Exception
response.write(ex.Message)
End Try
myConnection.Close()
End Function
Any help will be appreciated. I need to be able to retrieve the articles later and viewed in a web page that's why I was using varchar fields. Is it ok to use varchar or for the amount of text I am using should be using something else?