|
Missing to enclose query ")" after coun
Best Regard
Pathan
-- modified at 5:30 Friday 24th August, 2007
---------------------------------------------------
|
|
|
|
|
u can take the suggestion given by the previous thread
winnie
|
|
|
|
|
Hai,
Just my small suggestion..This is a regular problem when using the SQl query in this way and is considered a bad programming practice.. You can make it better and free from error by doing it like below.
SqlConenction con = new SqlConnection("database=anand;server=sdiserver;uid=sa;pwd=sa");
con.Open();
SqlCommand cmd = new SqlCommand("insert into jai(name,age,genter,country) values(@name,@age,@genter,@country)",con);
cmd.Parameters.Add("@name",SqlDbType.Char).Value = Txtname.Text;
cmd.Parameters.Add("@age",SqlDbType.Int).Value = int.Parse(Txtage.Text);
cmd.Parameters.Add("@genter",SqlDbType.Char).Value = txtgender.Text
cmd.Parameters.Add("@country",SqlDbType.Char).Value = coun;
cmd.ExecuteNonQuery();
This will help you a lot when doing queries with large number of parameters.
Hope this helps
Laddie
|
|
|
|
|
jai aswitha wrote: SqlCommand cmd=new SqlCommand("Insert into jai(name,age,gender,conntry)values('"+Txtname.Text+"','"+Txtage.Text+"','
"+txtgender.Text+"','"+coun+"'",con);
cmd.ExecuteNonQuery();
If this example is only for some demonstration purpose, then this is ok. You can accept the suggestion given by first poster. But if you are using this in a online server, It looks like you are very closer to SQL Injection Attacks. You should never write queries like this, use parameterized queries or stored procedures. To know regarding the attacks check this[^] excellent article.
|
|
|
|
|
Amongst all syntax and semantic errors that I would like to guide you in this query, the first and foremost to suggest you is that you should take remedial steps to solve the aggressive SQLInjection vulnerability that is blatantly visible in this code snippet.
|
|
|
|
|
Amongst all syntax and semantic errors that I would like to guide you in this query, the first and foremost to suggest you is that you should take remedial steps to solve the aggressive SQLInjection vulnerability that is blatantly visible in this code snippet.
...not to say anything about the sa account name and password.
|
|
|
|
|
Hey peeps.
Ive added a calender to my webparts catalogue, and done some formatting to it in terms of backrground and forecolour etc...
But when i Actually test it and import the calender from the catalogue during run time....it doesnt have the changes....its just its original boring formatting.
Anybody got a clue how and why this thing is messing with me?
thanx
Dazz
|
|
|
|
|
I have a serious problem with updatepanel and checkedchanged event. When the checkbox is in the updatepanel the checkedchanged event never fires when i step through my code, even though auto postback is enabled.
Is there a little trick to this that I'm missing?
|
|
|
|
|
try adding the checkedbox to the trigger collection of the UpdatePanel
|
|
|
|
|
Above step + Make the UpddateMode to Conditional.
|
|
|
|
|
Thanks alot, that worked fine... Its odd I forgot completely that i had set it to conditional about two weeks ago, and that was causing the problem.
|
|
|
|
|
In my app there are a lot of CheckBoxes in UpdatePanels all fireing the CheckedChanged event.
Could you please post a bit of your aspx definition, otherwise it is impossible to help.
btw: I do not use the trigger collection on the UpdatePanel, UpdatePanels are all set to Conditional as UpdateMode.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
hi,
in my application i have a checkbox, when user checks it n goes to another aspx page and returns to the previous page, the checkbox gets unselected...it must maintain the value.
How to do this...can anyone help?
im new to asp.net...can anyone tell me is it using sessions then how to use it..or viewstate...
|
|
|
|
|
by default asp.net handles viewstate, ,if not u can put this in the checkbox code in
EnableViewState=true
winnie
|
|
|
|
|
|
please send me the code to get values from the database(SQL Server 2000) to a dropdown list in ASP.Net.
-- modified at 3:14 Friday 24th August, 2007
|
|
|
|
|
Which database?
Which language?
Use an OleDbConnection and a command object to perform a sql query and then as you loop through your results populate the list. You can find documentation on this in the MSDN.
|
|
|
|
|
try the following code:
C#:
-----
SqlConnection con = new SqlConnection(connectionString);
String sql = "SELECT <field name=""> FROM ";
SqlCommand cmd =new SqlCommand(sql,con);
SqlDataAdapter sda =new SqlDataAdapter(cmd);
DataTable dt =new DataTable();
con.Open();
sda.Fill(dt);
DropDownList1.DataSource =dt;
DropDownList1.DataBind();
|
|
|
|
|
SqlConnection con= new SqlConnection("Server=IBM;DataSource=Master;User Id=sa;Pwd=sa");
SqlDataAdapter ada=new SqlDataAdapter("select * from customer",con);
DataSet ds=new DataSet();
ada.Fill(ds);
DropDownList1.DataSource=ds1.Tables[0];
DropDownList1.DataTextField=ds1.Tables[0].Columns[1].ToString();
DropDownList1.DataValueField=ds1.Tables[0].Columns[1].ToString();
DropDownList1.DataBind();
VanithaVasu
|
|
|
|
|
First create Connection with database and then
Dim databaseRecord As SqlDataAdapter
Dim dstRecord As DataSet
databaseRecord = New SqlDataAdapter("Select * from ", con)
dstRecords = New DataSet
databaseRecord .Fill(dstRecords)
dropdownlistname.DataSource = dstRecords
dropdownlistname.DataTextField = "<table_column_name>"
dropdownlistname.DataValueField = "<table_column_name>"
dropdownlistname.DataBind()
ash83
|
|
|
|
|
First create Connection with database and then
Dim databaseRecord As SqlDataAdapter
Dim dstRecord As DataSet
databaseRecord = New SqlDataAdapter("Select * from ", con)
dstRecords = New DataSet
databaseRecord .Fill(dstRecords)
dropdownlistname.DataSource = dstRecords
dropdownlistname.DataTextField = "<table_column_name>"
dropdownlistname.DataValueField = "<table_column_name>"
dropdownlistname.DataBind()
I hope this will workout
ash83
|
|
|
|
|
|
The Calendar Control has a property called SelectedDate. When you post back your first page, store that value from Calendar1 into a session variable. On your second page, you set Calendar2's SelectedDate to the session variable that has the original date.
|
|
|
|
|
Hello Everyone,
Can anybody let me know how set the width of a text box and other controls so that they look similar as they look in Internet Explorer
Actually i set a textbox width : 250 px; and it's being displayed great in Internet Explorer but in Mozilla it's looking just simple and even there is no effect in textbox's width..............................
|
|
|
|
|
Why don't u use CSS.
ash83
|
|
|
|