sql-server – INSERT权限被拒绝对象’employee_info’,数据库’工资单’模式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”,数据库“工资单”模式dbo上的INSERT权限被拒绝

我如何解决这个问题?

解决方法

您需要在sql Server(SSMS)中执行此操作(大概).

右键单击sql Server中的表,并向用户提供INSERT权限.

(……)

>右键单击表
>属性
>权限
>(如有必要)添加用户或角色
>点击用户/角色
>权限插入,在“授予”框中放置一个复选标记.

BTW – 你可以直接通过Tsql这样做,但是如果你现在有这个问题(你提到你是新的),那么可以先从GUI开始.

另外 – 这假设您有权在SSMS中执行此操作.如果你不是DBA / DBO,那么你可能需要联系某人…

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...