对象“employee_info"、数据库“payroll"架构 dbo 上的 INSERT 权限被拒绝 [英] INSERT permission was denied on the object 'employee_info', database 'payroll' schema dbo
问题描述
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myconnection As SqlConnection
Dim mycommand As SqlCommand
Dim ra As Integer
myconnection = New SqlConnection("server=IAI-004;uid=;pwd=;database=payroll")
myconnection.Open()
mycommand = New SqlCommand("INSERT INTO employee_info([employee_id],[first_name],[last_name],[middle_name],[email],[telephone],[gender],[status],[date_birth],[hire_date]) values ('" & Employee_idTextBox.Text & "','" & First_nameTextBox.Text & "','" & Last_nameTextBox.Text & "','" & Middle_nameTextBox.Text & "','" & EmailTextBox.Text & "','" & TelephoneTextBox.Text & "','" & GenderTextBox.Text & "','" & StatusTextBox.Text & "','" & Date_birthDateTimePicker.Text & "','" & Hire_dateDateTimePicker.Text & "')", myconnection)
mycommand.ExecuteNonQuery()
MessageBox.Show("New Row Inserted" & ra)
myconnection.Close()
End Sub
对对象employee_info"、数据库payroll"架构 dbo 的 INSERT 权限被拒绝
INSERT permission was denied on the object 'employee_info', database 'payroll' schema dbo
我该如何解决这个问题?
how can i resolve this problem?
推荐答案
您需要(大概)在 SQL-Server (SSMS) 中执行此操作.
You'll need to do this (presumably) in SQL-Server (SSMS).
右键单击 SQL-Server 中的表并授予用户 INSERT 权限.
Right-click the table in SQL-Server and give INSERT permissions to the user.
(...)
- 右键单击表格
- 属性
- 权限
- (如有必要)添加用户或角色
- 点击用户/角色
- 插入权限,在授予"框中打勾.
顺便说一句——你可以直接通过 TSQL 来做到这一点,但如果你现在遇到这个问题(你提到你是新人),那么也许可以从 GUI 开始,按照上面的说明.
BTW -- you can do this via TSQL directly, but if you're having this problem now (you mention that you're new), then maybe start with the GUI, per above first.
此外——这假设您有权在 SSMS 中执行此操作.如果您不是 DBA/DBO,那么您可能需要联系某人... :-)
Also -- this assumes you have access to do this in SSMS. If you're not the DBA / DBO, then you might need to contact somebody... :-)
这篇关于对象“employee_info"、数据库“payroll"架构 dbo 上的 INSERT 权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!