我如何...修复此错误 [英] How do i... fix this errpr

查看:65
本文介绍了我如何...修复此错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个我的班级

i有excucte函数问题SqlDbType

错误32'SqlDbType'不明确,从名称空间或类型'System.Data.SqlClient.SqlParameter导入,System.Data'。 F:\ proj\App_Code \ myprocalss.vb 84 72 F:\ proj \





如何解决这个问题错误





this my class
i have problem with excucte function SqlDbType
Error 32 'SqlDbType' is ambiguous, imported from the namespaces or types 'System.Data.SqlClient.SqlParameter, System.Data'. F:\proj\App_Code\myprocalss.vb 84 72 F:\proj\


how to fix this error


Public Class myfunc
 
    Public sqlcon As New SqlConnection
    Public sqlcmd As New SqlCommand()
    Public sda As New SqlDataAdapter
    Public sqlpar As New SqlClient.SqlParameter
    Public ds2 As New DataSet


Public Function cnsqlstoragepro(ByVal sqldbname As String, ByVal Procedure_Name As String, ByRef In_Par() As String, ByRef InPar_Typ() As Integer, ByRef In_Val() As String, ByVal Col_Name As String, ByVal Col_Value As String, ByVal TABLE_NAME As String, ByVal WHR As String)
       

  Try
            
            Dim sqlpar As New SqlParameter
            sqlcon.ConnectionString = "Server=localhost\SS;UID=sa;PASSWORD=admin@123;database= " & sqldbname & ";Max Pool Size=400;Connect Timeout=600;" 'myconnecting(sqldbname)
            If sqlcon.State = ConnectionState.Closed Then
                sqlcon.Open()
            End If
            sqlcmd.Connection = sqlcon
            sqlcmd.CommandText = Procedure_Name
            sqlcmd.CommandType = CommandType.StoredProcedure
            Dim i As Integer
            For i = 0 To i < In_Par.Length
                Select Case (InPar_Typ(i))
                    Case 1 '// integer
                        sqlpar = New SqlClient.SqlParameter(In_Par(i), SqlDbType.Int).Value = In_Val(i)

                   Case 2 '// nvarchar
                        sqlcmd.Parameters.Add(In_Par(i), SqlDbType.NVarChar).Value = In_Val(i)
                    Case 3 ' // datetime
                        sqlcmd.Parameters.Add(In_Par(i), SqlDbType.DateTime).Value = In_Val(i)
                End Select
                '   // switch InParTyps
            Next i
            ' //for In_Par 
            Dim SQLSTR As String = "select " + Col_Name + " , " + Col_Value + " from " + TABLE_NAME + " " + WHR
            sda = New SqlDataAdapter(SQLSTR, sqlcon)
            ds2 = New DataSet()
            ' sda.Fill(ds2)
            ' sqlcon.Close()
        Catch ex As Exception
            MsgBox("ERROR ........" + ex.Message)

        End Try

    End Function
End Class

推荐答案

基本上含糊不清的命名空间意味着,有2个类具有相同的名称(并且因为你添加了import,他们不知道要使用哪个类)



删除命名空间System.Data。

它可能得到解决
Basically what ambiguous namespace means, is that there are 2 classes that have the same name (and since you have added "imports", they do not know which class to use)

Delete the namespace "System.Data".
It may get resolved


这篇关于我如何...修复此错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆