Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: i have a problen
chris ong via DBMonster.com wrote:
> hi everyone...
>
> i have a bunch of codes here where i browse the computer for a txt
file
> then collect the information and store it into a database.. but i had
this
> error "invalid table name " and "invalid column name" when i run the
> codes... the codes are as below
>
> Private Sub submit_Click(ByVal sender As System.Object, ByVal e
As
> System.EventArgs) Handles submit.Click
> Dim something As String = something
> Dim oSQLConn As OleDbConnection = New OleDbConnection
> Dim strconn As String = "Provider=""OraOLEDB.Oracle"";User
> ID=esurvey;Password=esurvey;Data Source=esurvey;Extended Propertie" &
_
> "s=;Persist Security Info=False"
> Dim myConn As New OleDbConnection(strconn)
> myConn.Open()
>
> Dim sql1 As String
> ' Create an instance of StreamReader to read from a file.
> Dim sr As StreamReader = New StreamReader(myFile.Value)
>
> Dim line As String
> Dim str As String
> Dim i As Integer = 1
> Dim x As Integer = 1
> Dim length As Integer = 1
> Dim fieldColumn() As String
>
> Do
> line = sr.ReadLine
>
> If Not line Is Nothing Then
>
> Dim splitout As Object = Split(line, vbTab)
> fieldColumn = Split(line, vbTab)
>
> Dim tbRndStr As String = RndStr(4)
> Dim tRndStr As String
>
> If i = 1 Then
>
> sql1 = "CREATE TABLE " + tbRndStr + "("
> For Each str In splitout
> sql1 &= "" & str & " varchar(100) NULL"
> If x < fieldColumn.Length Then
> sql1 = sql1 & ", "
> x = x + 1
> System.Diagnostics.Trace.WriteLie
> (fieldColumn.Length)
> End If
> Next str
> sql1 &= ")"
>
> Dim SqlCommand1 As OleDbCommand = New
OleDbCommand
> (sql1, myConn)
> System.Diagnostics.Trace.WriteLine(sql1)
> SqlCommand1.ExecuteNonQuery() <--- Error
> Session(tRndStr) = tbRndStr
>
> thanks for any help
>
> --
> Message posted via http://www.dbmonster.com
Without seeing the substituted text it's difficult to tell, however it appears you're trying to create tables with numeric names. Since a table name cannot begin with a number your table name is, indeed, invalid. Likewise for the column names.
Find another algorithm to generate your table/column names. And next time post far more information than you did here, such as your actual error-generating command.
David Fitzjarrell Received on Mon May 16 2005 - 22:28:26 CDT
![]() |
![]() |