How to execute DDL Statement in ADO.NET ?

sqlserver2005 , vb.net , ado.net Kathmandu, Nepal
  • 11 years ago

    I am making project using vb.net and sqlserver 2005 and for connectivity, i have used ADO.NET. In past, i used to use ADO to connect database with front end in VB6 and i used to execute any DDL statement through the 'EXECUTE method of the CONNECTION object from the front end'. But in VB.Net, i am using ADO.Net and i am running DML statement (Insert,Update,Delete,Select) through OLEDBConnection or SQLConnection object but i got problem when i tried to run DDL Statement throughm them like in previous version of ADO. So, please if any of you have ideas about it, please help me. I will be very grateful to you. Expecting good suggestion and kind help regarding this matter.

  • 11 years ago

    I am making project using vb.net and sqlserver 2005 and for connectivity, i have used ADO.NET. In past, i used to use ADO to connect database with front end in VB6 and i used to execute any DDL statement through the 'EXECUTE method of the CONNECTION object from the front end'. But in VB.Net, i am using ADO.Net and i am running DML statement (Insert,Update,Delete,Select) through OLEDBConnection or SQLConnection object but i got problem when i tried to run DDL Statement throughm them like in previous version of ADO. So, please if any of you have ideas about it, please help me. I will be very grateful to you. Expecting good suggestion and kind help regarding this matter.

  • 11 years ago

    Hi shanker,

    For executing insert/update/delete statements user following way:

    Dim cmd As New SqlClient.SqlCommand cmd.Connection = your conenction object cmd.CommandText = "insert update or delete statement comes here" cmd.ExecuteNonQuery()

    Regards

  • 11 years ago

    Hi shanker,

    For executing insert/update/delete statements user following way:

    Dim cmd As New SqlClient.SqlCommand
    cmd.Connection = your conenction object
    cmd.CommandText = "insert update or delete statement comes here"
    cmd.ExecuteNonQuery()
    

    Regards

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.” - Martin Fowler