Avatar of EDW_Gideon
EDW_GideonFlag for United States of America asked on

Assistance w/ VB.Net data connection

I've taken over a project to convert a VB6 app into VB.Net, the application was started but not finished.  I'm very familiar w/ VB6 but not so familiar w/ VB.Net...  I've looked at DBProviderFactory on the MSDN site.  Essentially I'm getting by but the database connection process seems alien to me so I'm hoping that someone out there can help me get what I need to get done.  I'm trying to use this process to grant access permissions to tables and databases.  I'm just not sure how to simply execute the SQL and not return results. (other than success/failure)  I don't really understand how this connection works, it's much different than ADO in VB6, I can't seem to find an 'con.Execute' command.  Here's what I have thus far, I apologize for the potential mess you're about to see...  I've tried to piece together stuff the web and stuff that was entered by the previous dev to get the result I want:

If rblGrntRvk.SelectedValue = "0" Then
            SqlQuery.Append("GRANT ")
            SqlQuery.Append(" ON ")
            SqlQuery.Append(" TO ")
            SqlQuery.Append("REVOKE ")
            SqlQuery.Append(" ON ")
            SqlQuery.Append(" FROM ")
        End If

        SelStmt = SqlQuery.ToString()

        Dim pf1 As DbProviderFactory = DbProviderFactories.GetFactory("Teradata.Client.Provider")
        Dim con1 As DbConnection = pf1.CreateConnection()

        sConnection = "Data Source=" + Session.Contents("DataSource") + ";User ID=" + Session.Contents("AdminLogin") + ";Password=" + Session.Contents("AdminPasswd")
        con1.ConnectionString = sConnection


            Dim command1 As DbCommand = pf1.CreateCommand
            command1.CommandText = SelStmt
            command1.CommandType = CommandType.Text

            Dim adapter As DbDataAdapter = pf1.CreateDataAdapter()
            adapter.SelectCommand = command1

        Catch ex As Exception

        End Try
        Exit Sub
.NET ProgrammingVisual Basic.NETMicrosoft Development

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck