R
Rich
Greetings,
Just starting out with .net. I have a vb.net app where I
connect to an Access mdb. I use a connection component
from the tool box (conn1), a data adapter component from
the toolbox (da1) and create a typed dataset (ds1) and
populate a grid on a form (grd1). This all works fine and
I can see data from the Access mdb in the grid. But now I
want to add a record to the mdb.
In the data adapter da1 I see in the property sheet a
select command (selcmd1), insert command (insCmd1) and
delete command. For insCmd1 I set the connection to
conn1. Then I want to set the parameters. I have 3
fields in the Access table, fld1 (text), fld2 (number),
fld3 (date). In the Paramters dialog box of da1 for
insCmd1 I see a "Source Column" field, a "Value" field and
a "Parameter Name" field. On my vb form I have 3
textboxes, txt1, txt2, txt3. I want parm1 to have the
value in txt1, parm2 has value for txt2, parm3 for txt3.
Question: what do I put in the "Source Column field" for
parm1? How do I tell it to retrieve the value of
txt1.text? and so on.
Then I have a button (btn1) on the form which I click to
carry out the insert operation. I am not clear on the
syntax for carrying this out. Do I still have to say
insCmd1.Paramters.Add(txt1)
....
da1.SelectCmd = insCmd1
da1.InsertCommand = insCmd1.something
Well, this is what I tried without any success. Any
advice how to do this would be greatly appreciated.
Thanks,
Rich
Just starting out with .net. I have a vb.net app where I
connect to an Access mdb. I use a connection component
from the tool box (conn1), a data adapter component from
the toolbox (da1) and create a typed dataset (ds1) and
populate a grid on a form (grd1). This all works fine and
I can see data from the Access mdb in the grid. But now I
want to add a record to the mdb.
In the data adapter da1 I see in the property sheet a
select command (selcmd1), insert command (insCmd1) and
delete command. For insCmd1 I set the connection to
conn1. Then I want to set the parameters. I have 3
fields in the Access table, fld1 (text), fld2 (number),
fld3 (date). In the Paramters dialog box of da1 for
insCmd1 I see a "Source Column" field, a "Value" field and
a "Parameter Name" field. On my vb form I have 3
textboxes, txt1, txt2, txt3. I want parm1 to have the
value in txt1, parm2 has value for txt2, parm3 for txt3.
Question: what do I put in the "Source Column field" for
parm1? How do I tell it to retrieve the value of
txt1.text? and so on.
Then I have a button (btn1) on the form which I click to
carry out the insert operation. I am not clear on the
syntax for carrying this out. Do I still have to say
insCmd1.Paramters.Add(txt1)
....
da1.SelectCmd = insCmd1
da1.InsertCommand = insCmd1.something
Well, this is what I tried without any success. Any
advice how to do this would be greatly appreciated.
Thanks,
Rich