Question need to record, edit, view, delete database information

fire_water

New member
Joined
Jul 13, 2009
Messages
1
Programming Experience
Beginner
Ok so hopefully i can give enough information here. Our company has SQl 2005 on our server and I have Microsoft server management studio express and microsoft visual basic on my machine. I've created a new database "Product Pricing" with a table in it (Dbo.pricing information). It has 14 columns in it already.

I need to be able to add information to this and i have no idea how to.
I can access the database and retrieve the number of columns and rows with the following code:

VB.NET:
Expand Collapse Copy
Public Class Form1
    Private Conn As New ADODB.Connection

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Conn.Open("Driver={SQL Server Native Client 10.0};Server=Fileserv;Database=Product Pricing;Uid=PPCPricing;Pwd=mastermind")
        Dim rs As New ADODB.Recordset
        rs.CursorLocation = ADODB.CursorLocationEnum.adUseClient
        rs.CursorType = ADODB.CursorTypeEnum.adOpenStatic
        rs.LockType = ADODB.LockTypeEnum.adLockBatchOptimistic
        rs.Open("select * from [Pricing Information]", Conn)
        Dim da As New System.Data.OleDb.OleDbDataAdapter()
        Dim ds As New DataSet()
        da.Fill(ds, rs, "Pricing Information")
        Conn.Close()
        MsgBox(ds.Tables(0).Columns.Count)
        MsgBox(ds.Tables(0).Rows.Count)
End Sub
End Class

Can anyone tell me how to add information, edit information, ect. to my database?

Thank you.
 
Assume that the table structure is as follows,

Col1, Col2, Col3, Col4,....,Col14

and Col1 is Primary Key.


Insert SQL:

insert into [Pricing Information] select Col1_Value, Col2_Value, Col3_Value, Col4_Value,....,Col14_Value

or :

insert into [Pricing Information](Col1, Col2, Col3, Col4,....,Col14) values(Col1_Value, Col2_Value, Col3_Value, Col4_Value,....,Col14_Valu)



Update SQL(Edit):

update [Pricing Information] set Col2=Col2_Value, Col3=Col3_Value, Col4=Col4_Value, Col14=Col14_Value where Col1=Col1_Value



Delete SQL:

delete from [Pricing Information] where Col1=Col1_Value
_________________
Sabrina :):):)
 
Back
Top