Hi,

In asp.net I am using ODBC connection with dsn. I have some experience on VB6. In VB we used to append records in database with command;

connection.addnew

databasefieldname=somvalue

connection.update

my query is - can we do something like this in asp.net?


Alok

Not quite that easily but yes you can. You can specify an update query to run but how you formulate that query depends on the ODBC driver you are using. What type of database is it?

Here is a sample of how to interface with ODBC in .NET

private void button3_Click(object sender, EventArgs e)
    {
      DataTable result = default(DataTable); //if you're returning values
      try
      {
        using (System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection("DSN=..."))
        {
          conn.Open();
          const string query = "Update Table Set Field = 'Value'";
          using (System.Data.Odbc.OdbcCommand cmd = new System.Data.Odbc.OdbcCommand(query, conn))
          {
            using (System.Data.Odbc.OdbcDataReader dr = cmd.ExecuteReader())
            {
              result = new DataTable();
              result.Load(dr);
            }
          }
        }
      }
      finally
      {
        if (result != null)
          result.Dispose();
      }
    }

may be you can start with this kickstart tutorials...

<URL SNIPPED>

hope it helps...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.