在sql 2005的SQL Server Management Studio里面能保存数据吗?如果能,就是你程序的问题了.如果不能,看下面的内容.SQL Server 2005中,.mdf和.ldf文件附加,数据库成了只读的,该怎么解决?
1.打开 SQL Server Configuration Manager, 打开SQL Server SQLEXPRESS 的属性 2.在内置帐号处,把“网络服务”改成“本地系统”,重新启动SQL Server 2005 Express 后,再附加(Attach)数据库一切正常。 总结:之所以附加(Attach)上的数据库为“只读”,是因为启动SQL Server 的默认的启动帐号“网络服务”对所附加的数据库文件的权限不够造成的。 信息来源:
http://hi.baidu.com/tsq_124/blog/item/76227f1fe25d8165f624e4a4.html
1.打开 SQL Server Configuration Manager, 打开SQL Server SQLEXPRESS 的属性 2.在内置帐号处,把“网络服务”改成“本地系统”,重新启动SQL Server 2005 Express 后,再附加(Attach)数据库一切正常。 总结:之所以附加(Attach)上的数据库为“只读”,是因为启动SQL Server 的默认的启动帐号“网络服务”对所附加的数据库文件的权限不够造成的。 信息来源:
http://hi.baidu.com/tsq_124/blog/item/76227f1fe25d8165f624e4a4.html
可以运行但是数据库没有释放,怎样才能释放呢?
Private Sub cmdok_Click()
Dim fff As String
Dim gs As String
Set rs = CnNew.Execute("Select * From [jz] Where 帐号='" & Replace(txtUserName.Text, "'", "''") & "' And 密码='" & txtPassword.Text & "'")
If Not rs.EOF Then '如果符合
fff = rs("剩余时间")
gs = rs("挂失")
'关闭数据源
rs.Close: Set rs = Nothing
CnNew.Close: Set CnNew = Nothing
If gs = 0 Then '没有挂失
'Set gs = Nothing
Randomize Timer
Rnd (gs)
If fff > 0 Then '剩余时间不为零
'取消禁用任务管理器
Close
'取消禁用windows菜单
If bswap Then
SetParent win, task
ShowWindow win, 1
End If
Open "C:\Program Files\swkz\zh.txt" For Output As #1
Print #1, txtUserName.Text
Close
'Open "C:\Program Files\swkz\sj.txt" For Output As #1
'Print #1, fff
'Close
Randomize Timer
Rnd (fff)
Shell "C:\Program Files\swkz\dl.exe", vbNormalFocus
Call datalink.cloRs
Call datalink.Clocn
Unload Me '关闭现有窗体
'MsgBox "登录成功"
Else '如果不符合
txtUserName.Text = ""
txtPassword.Text = ""
Label5.Caption = "登录失败!剩余时间为零!"
End If
Else '如果不符合
txtUserName.Text = ""
txtPassword.Text = ""
Label5.Caption = "登录失败!帐号已经挂失!"
End If
Else
txtUserName.Text = ""
txtPassword.Text = ""
Label5.Caption = "登录失败!用户名或密码错误!"
'MsgBox "对不起,您的用户名密码不正确", vbCritical, "错误!"
End If
End Sub
在标准模块中
Public Sub Clocn()
'闭关数据库
On Error Resume Next
If CnNew.State <> adStateClosed Then CnNew.Close
Set CnNew = Nothing
End SubPublic Sub cloRs()
'闭关数据集
On Error Resume Next
If rs.State <> adStateClosed Then rs.Close
Set rs = Nothing
'End If
End Sub
//哈哈C#语法,不会VB,感觉应该也有相应的用法