|
SQl Express is not an answer. Your problem is that you cannot connect a db the way your are trying to. You have to create objects that connect with the SQL Server. You are getting Access Denied because SQL Server owns and controls the file.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Hi,
I create an ODBC Driver and find my databse; in VS2008, in Server Explorer I add my database(ODBC.Dell.Test)
I just get confuse; in MVC I have to add my database in App_data(is it true?)if yes, how?
because, again when I add that object get the same problem(Access Denied)
|
|
|
|
|
Hi All,
I have XML string as below. I am trying to deserialize this xml string in to a Request Object or NewHire Object. I have designed the Request class as it holds
the instance of NewHire class as a public property. I did in two ways
1. First time when I tried for the Request type it was giving exception like error in identifying property NewHire.
2. Then I deleted the Request element from the xml and kept from NewHire to /NewHire part only and then tried to deserialize the object for the NewHire type.
Then its not giving the exception but all the values in the NewHire instance it is giving null. Its not reading the values.
XML File :
----------
string strXML = "" + "<Request>" + "<NewHire>"
+ "<CompanyCandidateCode>CandCode</CompanyCandidateCode>"+ "<SSN>SSS</SSN>"
+ "<LastName>6456</LastName>"+ "<FirstName>3434</FirstName>"
+ "<MiddleName>676</MiddleName>"+ "<EthnicGroup>546456</EthnicGroup>"
+ "<Address>tuituiu</Address>"+ "<City>dfgfd</City>"
+ "<State>ghjgjg</State>"+ "<Zip>345345</Zip>"
+ "<HomePhone>bvnbvn</HomePhone>"+ "<OtherPhone>234234</OtherPhone>"+ "</NewHire>"+ "</Request>";
Deserialize Code:
----------------
try
{
System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(Request));
System.IO.TextReader reader =
new System.IO.StreamReader(new MemoryStream(ASCIIEncoding.Default.GetBytes(strXML)));
Request ObjItems;
ObjItems = (Request)serializer.Deserialize(reader);
reader.Close();
string str = Convert.ToString(ObjItems.NewHire.Address);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
I want to read this in to my Request or NewHire objects any of the above two methods ok. I prefer for the first one to fill the Request ojbect but if it can fill only NewHire
object and cant fill an object containing another object, I will adjust with NewHire only.
Can anybody please help me in this regard as I have to deserialize it in anyway.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
This article[^] should help, particularly the section Complex Object Serialization. It's all about the attributes.
|
|
|
|
|
Hi Gray,
I dont know your First Name to call but really it helped me a lot. Thanks for the excellent help. I am going to rate it very very excellent.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
I want to create (or borrow if one exists) a "news ticker" for our website that aggregates RSS feeds from vendors and news outlets into a section of our webpage. I want to maintain the functionality of being able to click through to the stories as you would when using an RSS reader. Is there something out there that already exists and I'm just not looking for the right thing? I know I've seen this on other websites and was just wondering if this is something that every website has developed on their own? Any help is much appreciated, thanks!
|
|
|
|
|
When I don't pass certain value in textbox. It gives me above exception.
Here's the code.
cmd.Parameters.Add("DOB", SqlDbType.SmallDateTime).Value = txtDOB.Text;
I want to ignore NULL values. How to tackle this problem.
I know it should have been easy. But anyhow, I stuck .
Regards
Asif Rehman
|
|
|
|
|
If the value in txtDOB.Text is a null or whitespace character, you need to set Value to DBNull.Value .
|
|
|
|
|
thanks for quick response.
So to my best understanding, I can replace
old phrase
cmd.Parameters.Add("DOB", SqlDbType.SmallDateTime).Value = txtDOB.Text;
with this one
cmd.Parameters.Add("DOB", SqlDbType.SmallDateTime).Value = (string.IsNullOrEmpty( txtDOB.Text)) ? DBNull.Value.ToString() : txtDOB.Text;
Is there any way shorter to do this.
Regards
Asif Rehman
|
|
|
|
|
I normally use a utility method like this:
public static object GetValueForParameter(string value)
{
if (!string.IsNullOrWhitespace(value))
return value;
return DBNull.Value;
} Then you can replace your code with cmd.Parameters.Add("DOB", SqlDbType.SmallDateTime).Value = Utility.GetValueForParameter(txtDOB.Text);
|
|
|
|
|
Thanks. It works.
Regards
Asif Rehman
|
|
|
|
|
You're welcome. Thanks for letting me know.
|
|
|
|
|
hi guys,
i just developed an easy ajax enabled page. but whenever i execute an ajax script i get an error:
'Access is denied'.
this site is running on the server and accessing it from my local machine.
is there anyone who knows why my ajax calls to the server are being denied?
Please help me.
Regards,Morgs
|
|
|
|
|
|
hi guys,, i want to open a model popup extender when a row inserted to the particualar table
now i can open a model popup window manually but i want it to be done automatically if a row inserted to the table in sql server 2005
Please let me know as soon as possible
Ahamed Azeem
software Programmer
|
|
|
|
|
if u want to do it from codebehind, make your main div to runat="server" so that you can access it from codebehind.
e.g.
After the code for inserting a new row executes the very last thing u must now do is to show the modal.
e.g.
public void InsertTableRow()
{
popupModal.Style.Value = "display:block;";
}
hope that helps...
|
|
|
|
|
You can use Open() method of ModalPopupExtender in code behind when new row is added.
|
|
|
|
|
Hi,
I am developing ASP.net and VS2010; I am using MVC; I right click on Model Folder to choose an Data Model; just wondering to know what is difference between Dataset and SQLServerDatabase?
|
|
|
|
|
Dataset are inmemory objects, these are used to store data (in table form).We fetch data from the databse, fill it in databse. Now we do our manipulation in the dataset and show the results accordingly. .NET provides the facility to do most of the opertaion that we can do with database table. We use dataset , when there is low no records in resultant table.
While SQLServerDatabase, we store in database. Ther are stored in files at harddisk.Obusly we have bit more flexibility over dataset. If number of records are higher, we use databse for all the manipulation..
|
|
|
|
|
what are the advantages of .ashx pages and how can I write Html tags in ashx file?
Sample url
Page Extension is ASHX[^]
|
|
|
|
|
We used to write HTTP Handlers at certain situations in our applications. In traditional way, writing Handlers needs to several steps. To avoid these, ASP.NET provides a way to write the HTTP Handler by just using a .ashx files.
We use Handlers, to handle certain situations like, if we want to process some different file extensions,for changing themes etc..
for details, have a look to followng links..
Click here 1
Click here 2
|
|
|
|
|
ok thanks for the links.
one more doubts, how to handle click events below submit button in the .ashx page.
context.Response.Write(
"<input type=submit name='Lookup'
value='Lookup'></input>");
|
|
|
|
|
I have to say that, given the importance of validating user input against SQL Injection, XSS and the like, that someone (.. Microsoft themsleves, as a .NET class) haven't written a comprehensive class library to take care of this. Client side validation doesn't count - though having said that, the routines used for that must go some way at least towards a solution.
I know that the new .NET validation server controls can validate server-side, but they still expect the user to define (too much) in terms of pattern matching, for example. i.e., they are too complex; what is really needed is something much simpler that just returns True or False depending on whether the input is a potential threat in terms of SQL Injection or XSS. Whether they've entered the correct data in the correct field is another issue.
I know it's a tricky task, but surely not beyond the wit of one of you eggheads out there But perhaps I've missed it, and there are such libraries available...
|
|
|
|
|
Hi all
I need to validate a string to allow html or simple text but not script language means a textbox can accept bold, italic tag of html
but not script tag like alert("hi");
how can i do this
Any help would be appreciated..
Amit
|
|
|
|
|
Just check the <script tag.
if(txtBox.Text.Contains("<script")
|
|
|
|