kwh3856
asked on
Format of the initialization string does not conform to specficiation starting at index 46
I am trying to open an SQL database and write a record. Here is the error message I am getting.
An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll
Additional information: Format of the initialization string does not conform to specification starting at index 46.
Here is the code.
'Get Math Objective Info
Dim m As Int32
Dim midx As Integer = 1
Dim mathObjNumbersArray(60) As String
For m = 1 To 101 Step 2
mathObjNumbersArray(midx) = Mid(mathObjNumbers, m, 2)
midx += 1
Next
Dim m1 As Int32
Dim midx2 As Integer = 1
Dim mathItemCorrectRespArray(6 0) As String
For m1 = 1 To 101 Step 2
mathItemCorrectRespArray(m idx2) = Mid(mathItemCorrectResp, m1, 1)
midx2 += 1
Next
Dim m2 As Int32
Dim midx3 As Integer = 1
Dim mathStudentRespArray(60) As String
For m2 = 1 To 101 Step 2
mathStudentRespArray(midx3 ) = Mid(mathStudentResp, m2, 2)
midx3 += 1
Next
Try
'Write Math Objective Info record
Dim objConnection2 As SqlConnection = New SqlConnection("server=(loc al);databa se=FBISK-T AKS;user id=sa;password=""")
Dim objCommand2 As SqlCommand = New SqlCommand
objCommand2.Connection = objConnection2
Dim m4 As Int32
For m4 = 1 To 60
objCommand2.CommandText = "Insert Into itemAnalysisDetail " _
& "(admDate, studentId, teacherId, objectiveNumber, itemCorrectResp, studentResp) " & _
"VALUES(@admDate, @studentId, @teacherId, @mathobj(m4), @mathItemCorrectRespArray( m4), @mathStudentRespArray(m4)) "
objConnection2.Open()
objCommand2.ExecuteNonQuer y()
objConnection2.Close()
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
Any help is greatly appreciated..
Thanks
Kenny
An unhandled exception of type 'System.ArgumentException'
Additional information: Format of the initialization string does not conform to specification starting at index 46.
Here is the code.
'Get Math Objective Info
Dim m As Int32
Dim midx As Integer = 1
Dim mathObjNumbersArray(60) As String
For m = 1 To 101 Step 2
mathObjNumbersArray(midx) = Mid(mathObjNumbers, m, 2)
midx += 1
Next
Dim m1 As Int32
Dim midx2 As Integer = 1
Dim mathItemCorrectRespArray(6
For m1 = 1 To 101 Step 2
mathItemCorrectRespArray(m
midx2 += 1
Next
Dim m2 As Int32
Dim midx3 As Integer = 1
Dim mathStudentRespArray(60) As String
For m2 = 1 To 101 Step 2
mathStudentRespArray(midx3
midx3 += 1
Next
Try
'Write Math Objective Info record
Dim objConnection2 As SqlConnection = New SqlConnection("server=(loc
Dim objCommand2 As SqlCommand = New SqlCommand
objCommand2.Connection = objConnection2
Dim m4 As Int32
For m4 = 1 To 60
objCommand2.CommandText = "Insert Into itemAnalysisDetail " _
& "(admDate, studentId, teacherId, objectiveNumber, itemCorrectResp, studentResp) " & _
"VALUES(@admDate, @studentId, @teacherId, @mathobj(m4), @mathItemCorrectRespArray(
objConnection2.Open()
objCommand2.ExecuteNonQuer
objConnection2.Close()
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
Any help is greatly appreciated..
Thanks
Kenny
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks to both of you very much....this was driving me nuts since I am new to VB.
Thanks
Kenny
Thanks
Kenny
ASKER