|
Hello Everybody,
1.I have an application where I want to restrict user to enter Blank/White space when they change their password.Can anyone give me the regex which prevent Blank/White space entry.
2. In a gridview I have a textbox which get it's value from a calendar I want that the textbox should not be editable, and it only get value from the calendar.
3.I face a problem in Sql Query. I have an application where user can change his/her address.
It gives sql exception when a user enter the address value containing "'s" example Ram's House. Can anyone tell me how to handle this issue.
SqlCommand MyComm = new SqlCommand("Insert into ADDRESS_Table (ADDRESS1,ADDRESS2,ADDRESS3,ADDRESS4) values ('" + txtAddress1.Text.ToUpper() + "' , '" + txtAddress2.Text.ToUpper() + "' , '" + txtAddress3.Text.ToUpper() + "' , '" + txtAddress4.Text.ToUpper() + "')", this.MyCon);
SqlDataReader MyReader = MyComm.ExecuteReader();
MyReader.Close();
MyComm.Dispose();
If anyone have the solution plz help me.
Have a nice day...
Happy Coding
A key to every Solution
|
|
|
|
|
1 - ^\s, I guess. But that doesn't prevent entry, it shows a message. You use jscript to prevent keypresses
2 - Then set it to be disabled, and only enable it when you change the value
3 - your code is a disaster, you should read up on SQL injection attacks. Fixing your code so it's safe will also fix the issue you're having.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
Thanks for your reply.
I am new to web development.
I want to stop user to entering white spaces. I used your regex but it display the error message if user enter any values other than white space . I need the regex which is opposite to it.
2. My calendar is a JavaScript calendar..can u tell me how to enable it. I disabled the textbox at the declaration time like
<asp:textbox id="strDate" enabled="false" onkeypress="return false;" runat="server" cssclass="bgcolor" width="100px">
if (!document.layers)
{
document.write("<img src="cal1.gif" onclick="popUpCalendar(this, Form1.strDate, ">
\"dd/mm/yyyy\")' height=17 width=18> ")
}
</img>
3. can u suggest me something on SQL Injection so that i can resolve my issues.
Happy Coding
A key to every Solution
|
|
|
|
|
AS@13 wrote: I want to stop user to entering white spaces. I used your regex but it display the error message if user enter any values other than white space . I need the regex which is opposite to it.
^[^\s]*$ this won't match text with spaces or line breaks.
AS@13 wrote: can u suggest me something on SQL Injection so that i can resolve my issues.
You should use parameterized queries or stored procedures to avoid them. Do a search for SQL Injection attack in CP - You will find useful articles.
|
|
|
|
|
AS@13 wrote: I am new to web development.
*grin* really ?
AS@13 wrote: I want to stop user to entering white spaces. I used your regex but it display the error message if user enter any values other than white space . I need the regex which is opposite to it.
Then try \s, I guess. ^ means not. Perhaps \S is whitespace and \s is not whitespace.
2 - you need to write javascript to enable the textbox, set the value and disable it again
3 - yes, if you want to be a programmer, I suggest learning how to use google and other search tools. There is at least one excellent article on this site on SQL injection, just type SQL injection into the search box.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: Then try \s, I guess. ^ means not
Yes. But ^\s will assert the position at starting, AFAIK. "not" would be [^\s]
|
|
|
|
|
Hi Friendz,
How to embed a word document in a webpage for preview?I tried with iframe's src property.But in that case Open,Save,Cancel Dialog is coming.Any one have any idea to read from a word file and display in web page.(Excluding COM).Thanks in advance.
Arun J
|
|
|
|
|
|
i am using asp.net+vb.net. How can i type in dropdown list .That dropdownlist already filled with values from database. when i type 'a' in dropdownlist that dropdownlist filled with values starting with letter 'a'.How can this possible.If anyone know this pls help me
|
|
|
|
|
The ASP.NET AJAX library contains a control that does this, I am pretty sure.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I cant use AJEX .If any other option
|
|
|
|
|
how to get session variable in HTML view
|
|
|
|
|
You men using Session Variables in .Html files. I guess it will not be possible since the server will not process this pages in any way.. You shoul rename them to ASP / ASPX.
Then you can easily set the Session valiable like tis
]]>
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
Hi there. I am currently working on a website assignment and I need some desperate help.
I am using SQL Server 2005 Express Edition to store my data. I am using C# to write my site.
I have used the OleDb to connect to the database, and to write and read the values.
I have stored binary data (photo, jpeg) via Oledb, there is no problems at all.
However I am stuck big time with retreiving photos. I am also using OleDb to connect to the database, then I placed the retreived data into a Dataset. I was able to retreive other information (such as name, phone numbers) from the dataset. However I am unable to retreive the binary data from the dataset.
I've searched the web, it seemed everyone is using SQLDataReader, so I was curious it is possible to retreive binary data using OleDb at all?
HELP! Any feedback would be appreciated, thanks!
modified on Monday, March 3, 2008 12:15 AM
|
|
|
|
|
Infernojericho wrote: I have used the OleDb to connect to the database, and to write and read the values.
Why have you not used the SQL Server specific classes built in to .NET ?
What have you tried to access your data ? If a datatable has a limit to how big a column can be, perhaps you have to use a datareader to get that byte stream out ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi all,
i am using onclick as well as onclient click event. if i am using onclientclick event my required field validation is not working.please help me in this . i am not finding where it causing prablem
Thanks And Regards,
Guru
|
|
|
|
|
Atually the validation controls are colled only on a post back. You will need take help of javascript to get the validations done in case of OnclientClick event
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
i want to validate gridview textbox value while updating, how can i do that.
|
|
|
|
|
This will give you the value on the text box
(Change the Cell[3] to the column number you want)
string str = ((TextBox)gridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text;
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
hi all
i am using iframe in html. why i am using iframe ,because there is some requirement of this. thats why i am using frame.
actually i want to create Rich Text Editor/ HTML Editor. for this purpose i am using iframe.
how can I read text from this iframe in codebehind and how can I set text in codebehind to this frame.
I use this iframe in ascx control. i use this control in aspx. i also use master page.
i need to save text/content of this iframe in database and then i need to show text/content from database in this iframe.
can anybody help me.
thanks
|
|
|
|
|
I am Facing problem in updating values using Gridview Please help me if you can. i,ll be very thabkful to you
Regards
Ahsan
|
|
|
|
|
Member 2528846 wrote: I am Facing problem in updating values using Gridview Please help me if you can
It's tough to tell what would be the problem as you haven't explained anything. Explain your problem in detail to get help.
|
|
|
|
|
I need to get file name and file create date from one of Virtual directory of IIS. One problem is each virtual directory is mapped to actual directory of network drive. How can I get file list from virtual directory? anyone can help me out please?
|
|
|
|
|
Use Server.MapPath[^] to convert a virtual path to a physical path. Then use the stuff in the System.IO namespace to obtain details about all files in a directory and individual file information.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Ok so I've been through some of the articles, had a rat through ASP.Net and solved most of the problems. Heres how it stands
I have a gridview gvProducts with autogenerate colums (I just want to see the data first)
I am using a ObjectDataSource which conforms to the required structure with Start & Max row parameters and rowcount etc.
The object returns a table, the grid displays the header text for each column but the is no data.
I have tested the proc (SQL 2005), debugged through the code and the proc returns a table with the required 19 rows, the object returns a populated datatable. The bloody grid won't show the data, only the header text.
The ASP Code
<asp:gridview id="gvProducts" runat="server" allowpaging="True" autogeneratecolumns="true" datasourceid="dsProduct" enablesortingandpagingcallbacks="True" pagesize="19"><br />
<pagersettings mode="NextPrevious" /><br />
</asp:gridview><br />
<asp:objectdatasource id="dsProduct" runat="server" selectmethod="GetPagedForGroup" typename="CSD.OurLibrary.clsProduct" enablepaging="True" selectcountmethod="GetRecordCount" startrowindexparametername="iRowIndexFrom" maximumrowsparametername="iMaxRows"><br />
<selectparameters><br />
<asp:sessionparameter defaultvalue="1" name="iGroupID" sessionfield="GroupID" type="Int32" /><br />
<asp:parameter name="iRowIndexFrom" type="Int32" defaultvalue="0" /><br />
<asp:parameter name="iMaxRows" type="Int32" defaultvalue="19" /><br />
<asp:sessionparameter defaultvalue="" name="sFilter" sessionfield="Filter" type="String" /><br />
</selectparameters><br />
</asp:objectdatasource>
|
|
|
|