Click here to Skip to main content
15,886,680 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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


SQL
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
Posted
Updated 28-Feb-16 21:35pm
v2

1 solution

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
 
Share this answer
 
v3
Comments
hashemraeeini 9-Mar-14 16:00pm    
thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900