Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
josef
Starting Member
15 Posts |
Posted - 2011-03-19 : 23:47:55
|
| I want to calculate row sum for two columns ,i found codes to do it .now I want to insert three text box input from form1 into column1 and three textbox input from form2 into col2 and set the row property to not grow.I have tried replace into statement "replace into table1( col1,col1,col1) values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "')" but I dont know how to get it to work .can some one help me to write a query that will do it.col1 col2 sum 1 10 11 2 20 22 3 30 33 total_all |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-03-20 : 08:14:03
|
| Not quite clear to me what you are trying to do, but, assuming you are using Microsoft SQL server, "replace into" is not valid syntax. If you want to replace data in a row you would use the update command. If you want to insert the data you should use insert command. See here:http://msdn.microsoft.com/en-us/library/ms177523.aspxhttp://msdn.microsoft.com/en-us/library/ms174335.aspxThose pages may look dense, but if you scroll down towards the end, they have examples. |
 |
|
|
josef
Starting Member
15 Posts |
Posted - 2011-03-21 : 00:09:18
|
| Thank you so much , the link is very helpful.I was trying to use insert onto statement like this : insert into table1( col1,col1,col1) values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "')"it doesnot work,if i use this statement : insert into table1( col1,col2,col3) values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "')" it works.I will go through the link you have provied me.Thank you again |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-03-21 : 09:02:19
|
| Also make use of parameters intead of concatenated sql statementsMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|