|
|
Table is a reserved word in SQL, so it is a bad idea to call a table "Table" - call it something significant, like Registration or UserReg
In MSSQl, if you are using a reserved word for something else, such as a table or column name, you must surround it with square brackets e.g.
SELECT * from [TABLE] ......
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
|
Your code is susceptible to SQL Injection[^].
For example, if the user types Robert';DROP TABLE [Table];-- in the username textbox, your query becomes:
select count(*) from Table where username = 'Robert';DROP TABLE [Table];
That's actually two queries; one to select the number of records with the username "Robert", and one to delete the entire table. The "--" at the end comments out the rest of the query.
It's quite easy to fix:
using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["userConnectionString"].ConnectionString))
{
cn.Open();
string sel = "select count(*) from [Table] where username = @username";
using (SqlCommand com = new SqlCommand(sel, cn))
{
com.Parameters.AddWithValue("@username", username.Text);
int temp = Convert.ToInt32(com.ExecuteScalar());
if (temp == 1)
{
Response.Write("User already exists..!!");
}
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
thanx.
|
|
|
|
|
Dear All,
My Requirement = I have page on which it having more than 8 tab,I want to display multiple grid onClick of each tab,If i write code in each tab ContentTemplate, my page become to heavy,so it will take lot of time to load.
Current Way = I am using Ajax tab control in one of my project it has ContentTemplate and each ContentTemplate has one iframe, so onclick of each tab related page open in related iframe and all the grid on that page loads.
Problem Current Practice : = No of Pages increases.
Question : Can you suggest me best practice of Tab Concept,So that on each tab click,i should able to load heavy grid, so that each tab content load quickly.
My requirnment is I want to keep Tab Concept only.
Thanking You
|
|
|
|
|
How can I add cell with specific background?
Dim spreadsheet As DocumentFormat.OpenXml.Packaging.SpreadsheetDocument
Dim worksheet As DocumentFormat.OpenXml.Spreadsheet.Worksheet
Dim styleXml As String
spreadsheet = Excel.CreateWorkbook(workbookName)
If (spreadsheet Is Nothing) Then
Return
End If
Excel.AddWorksheet(spreadsheet, "Test")
worksheet = spreadsheet.WorkbookPart.WorksheetParts.First().Worksheet
?????
worksheet.Save()
|
|
|
|
|
when we need cookiless session and why?
|
|
|
|
|
This article from Microsoft has a good summary: http://msdn.microsoft.com/en-us/library/aa479314.aspx[^]
If your the users using your web application have cookies disabled in their browser then you can use CookieLess sessions. The session ID gets encrypted and put into the query string instead of into a cookie. Your code does not need to change at all, unless you were trying to use cookies.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
|
You're welcome.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
This is more an HTML question than ASP.NET, but since there's no HTML forum (and the answers I've gotten from google are not helpful) here goes:
I see this a lot (example from Foundation):
<nav class="top-bar" data-topbar</nav>
data-topbar is invalid XML because it has no value (no ='' )
Is this some bizarre shortcut that only HTML understands? What if I assign a value like an empty string?
I see this frequently in javascript libraries, it's not something exclusive to Foundation.
Thoughts?
Marc
|
|
|
|
|
Aren't you missing a closing > after data-topbar?
|
|
|
|
|
HTML != XML (unless you're using XHTML, which was popular for a while).
What you're looking at is a boolean attribute:
Some attributes play the role of boolean variables (e.g., the selected attribute for the OPTION element). Their appearance in the start tag of an element implies that the value of the attribute is "true". Their absence implies a value of "false".
Boolean attributes may legally take a single value: the name of the attribute itself (e.g., selected="selected" ).
In HTML, boolean attributes may appear in minimized form -- the attribute's value appears alone in the element's start tag. Thus, selected may be set by writing:
<OPTION selected>
instead of:
<OPTION selected="selected">
Authors should be aware that many user agents only recognize the minimized form of boolean attributes and not the full form.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: What you're looking at is a boolean attribute:
Thanks! HTML again!
But I appreciate your finding the link for me to explain this interesting format.
Marc
|
|
|
|
|
i m new in asp.net...
plz provide a code or ideas...
that how to create quick answer forum same like in code project...
|
|
|
|
|
Your question was already answered here[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi all,
So my big problem is this, i have a class that creates a PDF directly to a memorystream. Whit this i can download and show a file in browser without doiwnloding it, the main problem is how can i redirect the file to a div, to be showned there.
Thanks
|
|
|
|
|
As far as I know, you can't do that. However, you can put an iframe tag inside the div and link the iframe to the location of the pdf, or in your case the webpage that serves the memorystream. Make sure to set the content type to application/pdf in the response header. The browser will take it from there.
|
|
|
|
|
This is my code
ReportViewer rptvw1 = new ReportViewer();
rptvw1.ProcessingMode = ProcessingMode.Local;
rptvw1.LocalReport.ReportPath = p.Server.MapPath("~/GridReport.rdlc");
BL_Insurance.PrintDetail print = new BL_Insurance.PrintDetail();
DataTable ds = print.Print(Convert.ToInt32(p.Session["transactionid"]), Convert.ToString(p.Session["typeofplan"]), Convert.ToInt32(p.Session["UserID"]));
ReportDataSource datasource = new ReportDataSource("DataSet1", ds);
rptvw1.LocalReport.DataSources.Clear();
rptvw1.LocalReport.DataSources.Add(datasource);
ReportParameter[] param = new ReportParameter[4];
param[0] = new ReportParameter("Company", Convert.ToString(p.Session["insurancecompany"]));
param[1] = new ReportParameter("Policy", Convert.ToString(p.Session["policyname"]));
if (ds.Columns.Contains("Adult"))
{
param[2] = new ReportParameter("Adult", "True");
param[3] = new ReportParameter("Child", "True");
}
else
{
param[2] = new ReportParameter("Adult", "False");
param[3] = new ReportParameter("Child", "False");
}
rptvw1.LocalReport.SetParameters(param);
rptvw1.LocalReport.Refresh();
Warning[] warnings = null;
string[] streamIds = null;
string mimeType = string.Empty;
string encoding = string.Empty;
string extension = string.Empty;
filetype = "PDF";
fname = DateTime.Now.ToString("yyyyMMddHHmmssfff");
byte[] bytes = rptvw1.LocalReport.Render(filetype, null, out mimeType, out encoding, out extension, out streamIds, out warnings);
finally am getting this format as byte array.
I want to print this byte array without saving any format.
Please tell me how to print this byte array directly.
|
|
|
|
|
How multiply two values one from database and one from user and print in another textbox.
|
|
|
|
|
- Read the values
- Parse them to integers or floats
- Multiply them together
- Format the answer to a string
- Put the string into the textbox
BTW, in future please use the correct forum, and explain your problem in better detail.
|
|
|
|
|
Hi All,
I am trying to prebuild and application when I have put the xcopy commands as below, initially it threw error as the specified folder doesn't exist at the target location.
Is there any way to write some intelligent login for the precompile so that when the precompile is happening, if there is no specified directory in the target location, it will create one automatically, if there is it will over write all the directories and files automatically without prompting the user.
Please any kind of help or support is very helpful, any link or suggestion or example would help a lot.
thanks in advance.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Use the /E switch with xcopy. That will copy the directory structure, including empty directories.
xcopy C:\Source\*.* D:\Target\*.* /E
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hi,
I have used the same thing, it successfully does precompile once but then the folder and files are not available already it fails, by throwing error the command xcopy exited with code 2. May be it is unable to replace the existing ones.
Can you please give me option for both situations when there is no folder available and when there is everything available but still replaces with without prompting any message on to the command prompt.
Can you please help me in this regard.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|