|
What you have tried about to insert value you have no mention whatever,
You can easily insert value into your database table by using
Insert into tablename values(your value depend upon table column data type)
|
|
|
|
|
|
for example here is some part of my code:
string str="Birthday";
i have to insert this str variable using:
INTERT into mytable VALUES(str) ;
how can i insert this???
n i dont know how to use parameters...plz tell me some very easy way to do this...
|
|
|
|
|
It partly depends on what language you host your SQL in, also on which database system you use.
INSERT INTO table (field0, field1 ...) VALUES (@Param0, @Param1 ... )
Then create parameters.
Then, as you loop through the data to insert, set the parameters and execute the statement.
|
|
|
|
|
I let you from the beginning step by step to insert data into table
Create a connection by using SqlConnection class as
SqlConnection con = new SqlConnection("connectionString")
then, you need to create Command object by SqlCommand Class as
string str = INTERT into mytable VALUES('"+str+"');
SqlCommand cmd = new SqlCommand(str,con);
then you need to execute query by using ExecuteNonQuery Method as
cmd.ExecuteNonQuery();
This is easiest way to insert data into table. Hope it will work for you.. 
|
|
|
|
|
thanks a lot RaviRanjankr! for ur concern...but i have tried this is a simple one...actually + sign is not recognized in the query, it gives syntex error...but n e ways thanks a lot my problem has been solved now,thanks
|
|
|
|
|
if you don;t want to use parameter then simple make Connction and Command and Execute your command it will save your data.
|
|
|
|
|
Please don't give people bad advice like this. You've basically just advised the poster that they should leave themselves wide open to a SQL Injection attack, and that's not cool.
|
|
|
|
|
|
|
i can't understand your comment? can you describe it?
|
|
|
|
|
Two Words.
First word, Homer.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
please don't advertise your wares the forums please..
As barmey as a sack of badgers
Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.
|
|
|
|
|
This is inappropriate, you should be writing an article for CP rather than peppering links to your web/blog.
The only reason it is still here is that it is borderline.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
|
Hello,
I use Microsoft's Oracle client provider.
I have 2 Oracle stored procedures that do the same thing and have only different names:
SP1:
create or replace procedure GetScalar(last_name IN PERSON.LastName%TYPE, row_count OUT INTEGER)
as
begin
SELECT COUNT(*) INTO row_count FROM PERSON
WHERE LASTNAME = last_name;
end GetScalar;
SP2:
create or replace procedure Get_Bool(last_name IN PERSON.LastName%TYPE, r_count OUT INTEGER)
as
begin
SELECT COUNT(*) INTO r_count FROM PERSON
WHERE LASTNAME = last_name;
end Get_Bool;
I use the same C# code for both.
When I use stored procedure SP1 after this code was called:
OracleCommandBuilder.DeriveParameters(objCmd);
int n = objCmd.Parameters.Count;
n is 2, which is ok.
But, when I use stored procedure SP2:
n is 0, which is not ok.
What should I do yo make it work?
When I call both store procedures inside Oracle enviroment both work fine.
|
|
|
|
|
Would help if code tags were used but it appears that the stored proc signature, excluding identifiers, is the same.
If that is the case then you have a faulty assumption.
You are assuming that a difference in identifies makes a difference. Excluding key word usage (which I do not see any) that is not possible.
Since it isn't possible it suggests that you need to look for a difference source of the problem.
So possible reasons are the following. This is not a complete list.
- The proc in your C# code is not named correctly.
- The proc does not exist in the database, or it is an older version with no parameters.
- You are pointing at a different database.
|
|
|
|
|
Roll your own -- don't depend on automagic tools.
|
|
|
|
|
random question retrival from database
|
|
|
|
|
You could always try asking a question.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
the OP does not have a question, he wants to get a question, a random one.
|
|
|
|
|
I sets them up, he knocks them down...
Hey: fix cp vanity: I'm sure you can't have anything better to do
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
|
How was your mushrooms yesterday?
"When did ignorance become a point of view" - Dilbert
|
|
|
|