473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How can i define InsertCommand in SQLDataAdapter?

Hi,
I need define InsertCommand in SQLDataAdapter, but I don't know how. Please
Help me. I don't know the format of InsertCommand.

Thanks
Nov 16 '05 #1
1 2310
The Adapter has an .InsertCommand Property that will allow you do specify
the command you want to use

string sql = "Insert into blah blah blah values @blah, @blah1, @blah2";
SqlCommand cmd = new SqlCommand(sql, connection);
myDataAdapter.InsertCommand = cmd;

Is the problem you're having otherwise with the parameters? I'd recommend
using the configuration wizard on a table that you know has a primary key -
just pick 5 or 6 fields. Then walk through the wizard and hit finish. It
should tell you it generated the statements for each command. Then just
look at it in the code window - it's a bit verbose but will give you a
pretty good idea for what happened.
"Luboš Šlapák" <lu**********@centrum.cz> wrote in message
news:uW**************@TK2MSFTNGP11.phx.gbl...
Hi,
I need define InsertCommand in SQLDataAdapter, but I don't know how. Please Help me. I don't know the format of InsertCommand.

Thanks

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: hamid S | last post by:
Hi, I am new to ADO.Net and I am getting system error when I try to issue the System Error and sqlDataAdapter.InsertCommand.ExecuteNonQuery to update the database. What could be wrong. Please...
2
by: Pablo Salazar | last post by:
Hi everybody I need your help With this code read data from table Usuarios and I show it in a Datagrid. cn.Open (); SqlDataAdapter da = new SqlDataAdapter("Select Usuario,Apellidos from...
5
by: Darryn Ross | last post by:
Hi, I am running an insert statement into an access database, but i don't want to add information to every column in my table... when i run my insertcommand the following exception is thrown......
3
by: Jon S via DotNetMonster.com | last post by:
Hi all, I'm having a problem updating a simple change I've made to a Access 2000 table through databinding. The error I get is : An unhandled exception of type...
1
by: zoneal | last post by:
I retrieved the following function from VB.NET help and added a few statements for updating the datasource. But, it does not actually commence the InsertCommand property of the DataAdapter in order...
3
by: Rich | last post by:
What is the diffeence bewtween a dataAdapter.InsertCommand and dataAdapter.SelectCommand (and dataAdapter.UpdateCommand for that matter)? Dim da As SqlDataAdapter conn.Open da.SelectCommand =...
2
Elnath
by: Elnath | last post by:
im connecting to a DataBase tru ODBC, i need to insert new records (rows) therefore i want the InsertCommand to be generated by my CommbadBuilder. This solution however is aint working, the...
2
by: RP | last post by:
>From the below given codes used to insert a record in a table, which code is well-optimized and must be used. Please also let me know why it is better. ...
2
by: Cirene | last post by:
In my HTML view of my ASPX page how do I use the NOW() function for the InsertCommand? This doesn't seem to work... Code snippet: <asp:SqlDataSource ID="sdsPress" runat="server"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.