locked
A little help with some VB syntax RRS feed

  • Question

  • User-653715245 posted

    I'm a C# programmer who is currently writing a lot of VB, I'm a bit stuck on some syntax.

    I started with this:

    Dim sqlParams() As SqlParameter = { _
                 Database.CreateParameter("@CustomerID", SqlDbType.Int, ParameterDirection.Input, CustomerID), _
                 Database.CreateParameter("@SourceSystem", SqlDbType.VarChar, ParameterDirection.Input, "Zeiss", 5)} 
    
    Database.Fill("prcCustomerSourceLinksSearch", sqlParams)
    

    But I would like to write something like this:

    Database.Fill("prcCustomerSourceLinksSearch", { _
                             Database.CreateParameter("@CustomerID", SqlDbType.Int, ParameterDirection.Input, CustomerID), _
                             Database.CreateParameter("@SourceSystem", SqlDbType.VarChar, ParameterDirection.Input, "Zeiss", 5)})
    
    

    The second bit of code doen't compile, is this kind of appraoch possible in VB?

    Thursday, October 23, 2008 4:08 AM

Answers

  • User397347636 posted

     

    Database.Fill("prcCustomerSourceLinksSearch", New SqlParameter() { _
                             Database.CreateParameter("@CustomerID", SqlDbType.Int, ParameterDirection.Input, CustomerID), _
                             Database.CreateParameter("@SourceSystem", SqlDbType.VarChar, ParameterDirection.Input, "Zeiss", 5)})
    
    
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 23, 2008 11:55 AM

All replies

  • User-990694832 posted

    Sorry to say but i dont think so.

    DK 

     

    Thursday, October 23, 2008 8:37 AM
  • User397347636 posted

     

    Database.Fill("prcCustomerSourceLinksSearch", New SqlParameter() { _
                             Database.CreateParameter("@CustomerID", SqlDbType.Int, ParameterDirection.Input, CustomerID), _
                             Database.CreateParameter("@SourceSystem", SqlDbType.VarChar, ParameterDirection.Input, "Zeiss", 5)})
    
    
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 23, 2008 11:55 AM
  • User606145667 posted

     

    try the following link which will convert your c# to vb code.

    http://www.developerfusion.com/tools/convert/csharp-to-vb/

     

    hope this helps

    Thanks

     

    Thursday, October 23, 2008 11:58 AM