• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 216
  • Last Modified:

Insert & Find a specifi row

Can someone show me how to insert new records and find a specific row  both SQL and ACCESS database?
0
VBdotnet2005
Asked:
VBdotnet2005
1 Solution
 
af4643Commented:
To insert:

INSERT INTO table_name (column1, column2,...)
VALUES (value1, value2,....)


To find:

SELECT column FROM table
WHERE column = value


Those will be your query string.

First, make a connection to your DB, then execute the command:
Dim conn as sqlconnection = new sqlconnection("connection string")
Dim cmd as sqlcommand = new sqlcommand("query string", conn)


to insert:
conn.open()
cmd.executenonquery()
conn.close()

to find:
Dim reader as sqldatareader
conn.open()
reader.executereader()

while reader.read()
    'reader("column name")             that will access the specified column name, row by row
end while
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now