B
Butt Chin Chuan
I got this error where I'm given the error message below:
Index #0
Error:
System.Data.SqlServerCe.SqlCeError: This is a file sharing
violation. A different process might be using the file.
[,,,,,]
The following code is the culprit, although I don't know
how to overcome it. When I try to put a message box in the
code, the message box keeps looping itself. I wonder why?
I mean, I just bind a datatable to a combobox, it
shouldn't trigger any loop, right? I've solve this type of
error before, it usually comes out when i didn't open a
connection or haven't close a connection, but this
completely something else, since it keeps looping around.
In this code, I should get 6 items to be binded to
combobox, and the message box only appear once. However, I
keep having to press the Ok button on the message box so
many times until the application hang and give me the
error message above. Please comment. Any help is welcomed.
Thank you very much in advance.
Private Sub LoadServiceAttribute()
Dim objSqlDataAdapter as New SqlCeDataAdapter
Dim objDataSet as New DataSet
Dim objDataTable as New DataTable
sqlconn = New SqlCeConnection
'Create a connection string
sqlconn.ConnectionString = "DataSource=\My
Documents\mobileISSQ.sdf"
'Make another copy of the connection string
strConnection = sqlconn.ConnectionString
Dim objConnection As New SqlCeConnection
(strConnection)
Msgbox ("here")
sqlconn.Open()
sql = "SELECT distinct ServAttribList.nameBM as
ServiceAttribute " & _
"FROM ServAttribList, ServIntResp " & _
"where ServAttribList.sgid = '" & Gsgid
& "' " & _
"and ServAttribList.said =
ServIntResp.said"
'MsgBox(sql)
objSqlDataAdapter = New SqlCeDataAdapter(sql,
sqlconn)
objSqlDataAdapter.SelectCommand = New SqlCeCommand
(sql, sqlconn)
objSqlDataAdapter.Fill
(objDataSet, "ServAttributeList")
objDataTable = objDataSet.Tables
("ServAttributeList")
cbAttribute.DataSource = objDataSet.Tables
("ServAttributeList")
cbAttribute.DisplayMember = "Service Attribute"
cbAttribute.ValueMember = "ServiceAttribute"
lblAttributeDetail.Text = cbAttribute.Text
sqlconn.Close()
End Sub
Index #0
Error:
System.Data.SqlServerCe.SqlCeError: This is a file sharing
violation. A different process might be using the file.
[,,,,,]
The following code is the culprit, although I don't know
how to overcome it. When I try to put a message box in the
code, the message box keeps looping itself. I wonder why?
I mean, I just bind a datatable to a combobox, it
shouldn't trigger any loop, right? I've solve this type of
error before, it usually comes out when i didn't open a
connection or haven't close a connection, but this
completely something else, since it keeps looping around.
In this code, I should get 6 items to be binded to
combobox, and the message box only appear once. However, I
keep having to press the Ok button on the message box so
many times until the application hang and give me the
error message above. Please comment. Any help is welcomed.
Thank you very much in advance.
Private Sub LoadServiceAttribute()
Dim objSqlDataAdapter as New SqlCeDataAdapter
Dim objDataSet as New DataSet
Dim objDataTable as New DataTable
sqlconn = New SqlCeConnection
'Create a connection string
sqlconn.ConnectionString = "DataSource=\My
Documents\mobileISSQ.sdf"
'Make another copy of the connection string
strConnection = sqlconn.ConnectionString
Dim objConnection As New SqlCeConnection
(strConnection)
Msgbox ("here")
sqlconn.Open()
sql = "SELECT distinct ServAttribList.nameBM as
ServiceAttribute " & _
"FROM ServAttribList, ServIntResp " & _
"where ServAttribList.sgid = '" & Gsgid
& "' " & _
"and ServAttribList.said =
ServIntResp.said"
'MsgBox(sql)
objSqlDataAdapter = New SqlCeDataAdapter(sql,
sqlconn)
objSqlDataAdapter.SelectCommand = New SqlCeCommand
(sql, sqlconn)
objSqlDataAdapter.Fill
(objDataSet, "ServAttributeList")
objDataTable = objDataSet.Tables
("ServAttributeList")
cbAttribute.DataSource = objDataSet.Tables
("ServAttributeList")
cbAttribute.DisplayMember = "Service Attribute"
cbAttribute.ValueMember = "ServiceAttribute"
lblAttributeDetail.Text = cbAttribute.Text
sqlconn.Close()
End Sub