|
-
Jan 19th, 2007, 02:41 AM
#1
Thread Starter
Junior Member
error msg : value type string cannot be converted......
Dim oConfig As System.Configuration.Configuration
Dim strConnectionString As String
oConfig =Configuration.WebConfigurationManager.OpenWebConfiguration("/myob")
If (oConfig.ConnectionStrings.ConnectionStrings.Count > 0) Then
strConnectionString = oConfig.ConnectionStrings.ConnectionStrings("myAccountConnectionString2").ConnectionString
Else
Throw New ApplicationException("Could not load the database")
End If
Dim query2 As String = "SELECT f008jumlah FROM t008AsetSemasa "
Dim sqlCom As SqlCommand = New SqlCommand(query2, strConnectionString)
Dim sqlReader As SqlDataReader = sqlCom.ExecuteReader()
sqlReader = sqlCom.ExecuteReader()
Dim jum As Decimal
Dim index As Integer
jum = 0
While sqlReader.Read()
jum = jum + sqlReader("f008jumlah") & ControlChars.NewLine 'This will add whatever is in that column to a new line in the textbox
jumAset.Text = jum
index += 1
End While
the code that i bold have a error. the error message say " Value of type ' String' cannot be converted to system.Data.sqlClient.SqlConnection.
but when i used the same code for connection in INSERT statement, the code can be running,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|