|
The Article by Zeeshan Muhammad Themes&Skin[^]will help you in this regard.
Regards,
Satips.
|
|
|
|
|
I'm pretty sure the answer to this is simply but I'm currently lost. I am developing an "Extranet" site for my clients, here they can log in, track the progress of their site, approve pages as they're completed, upload Word documents with copy for certain pages and so on. To do this I'm wanting to use SQL as my data solution.
My host, unfortunately, doesn't have SQL running on his server (it's not an actual "hosting company", he's a long time friend who happens to have large servers for a company he used to own (lost funding) that I was lead developer for. I've read some on SQL2005 Express but I'm wanting to know how I can add a database in the App_Data folder and have it work without SQL being on the host server.
I tried right-clicking on the App_Data Folder and adding new item, select "SQL Database" and it adds it just fine but when I try to add tables or anything I get a weird error (shown in this image[^] (I blurred out part of the path so as my computer information and name isn't visible).
Is it possible to attach SQL2005EXPRESS without SQL running on the host machine? If so how?
" In the next millennium there are two kinds of business, those on the Internet and those out of business"
Bill Gates
"Be nice to nerds. Chances are you'll end up working for one."
Bill Gates
"Let's face it, the average computer user has the brain of a Spider Monkey."
Bill Gates
|
|
|
|
|
RLMcCutchen wrote: I've read some on SQL2005 Express but I'm wanting to know how I can add a database in the App_Data folder and have it work without SQL being on the host server.
You really can't. Not unless you store all your data as XML or you use Access, or something.
SQL Express is OK, but not good if it will be used by many people at once.
RLMcCutchen wrote: (it's not an actual "hosting company", he's a long time friend who happens to have large servers for a company he used to own (lost funding)
This sounds like a disaster. You want to expose your clients to this mess ? Get a real host. One with SQL Server.
RLMcCutchen wrote: Is it possible to attach SQL2005EXPRESS without SQL running on the host machine? If so how?
Of course not. If the database is not running on the host machine, or a machine visible to the host, then it's not going to work, is it ?
However, Access would be fine. You just need to work out what's holding the file open when your code tries to open it ( that's what that error is )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian,
Their sites aren't going to be hosted with my site, they have their own host so I wont be exposing them to anything. Like I said, this is a fairly simple "Extranet" that the client can log into and we can communicate back and forth with one another, they can upload documents to my site for me to use and so on, it is in no way connected to their site at all. Eventually we will (hopefully within the month) have SQL 2005 back up and running on the server I'm hosted on and this wont be a problem. The SQL Express wont be used by many people at once, maybe 5 -10 at a time for now, by the time it's more this wont be an issue as SQL 2005 will be on the server. I was just looking for a solution for the time being.
PS: I do have a real host, he has 13 Dell Blade Servers and a central server for running SQL (it's just not up and running as of yet). He is hosting several mission critical sites using SQL but his current SQL is Co-Hosted elsewhere and they wont let me connect via Enterprise Manager or Query Analyzer so I cant use their database server.
" In the next millennium there are two kinds of business, those on the Internet and those out of business"
Bill Gates
"Be nice to nerds. Chances are you'll end up working for one."
Bill Gates
"Let's face it, the average computer user has the brain of a Spider Monkey."
Bill Gates
|
|
|
|
|
I want to set contact_us.aspx like the web site default page, but i cant reach the iis admin, can i do by another way?, maybe the web.config..
keep Learning and you never will be out of date...
|
|
|
|
|
You normally would do it through the iis admin. There is a tab where you set the default page. If that is not an option you can do some http re-direction so when the default.aspx page is requested you could auto redirect. The easiest way to do this is to create a default.aspx page and in the page load event to a response.redirect("contact_us.aspx")
Hope that helps.
Ben
|
|
|
|
|
No, you need to tell IIS what page to load by default. You could just change your index.aspx, or whatever, to redirect to the page you want ? Or does the index page get used elsewhere ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
strSQL="UPDATE [q1], [q2], [q3], [q4], [q5], [q6], [q7], [q8],"+<br />
" [q9], [q10], [q11], [q12], [q13], [q14], [q15],"+<br />
" [q16], [q17], [q18], [q19], [q20], [q21], [q23],"+<br />
" [q24], [q26], [q28], [q34], [q35], [q38], [q39],"+<br />
" [q40], [q42], [q43], [q44], [q45], [q46], [q47],"+<br />
" [q48], [q51], [q52], [q53], [q54], [q57], [q58],"+<br />
" [q61], [q62], [q63], [q66], [q67], [q70], [q71],"+<br />
" [q72], [q73], [q74], [q75], [q84], [q85], [q86],"+<br />
" [q87], [q88], [q89], [q90], [q91], [q98], [q99],"+<br />
" [q100], [q101],"+" [q102], [q103], [q104], [TCAIMSSite],"+<br />
" [DTG_Submit], [LoginID], [TestPhase]"+<br />
" FROM t_EOT_User WHERE RecNum="+RecNum.Text;<br />
error says SYNTAX errror on UPDATE Statement
|
|
|
|
|
What happens if you type this text into SQL Server directly ?
I trust this code is not in your .aspx.cs file ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I wish I was using an SQL server, access database.
|
|
|
|
|
OK, an MDB file ? What if you recreate your table structure in SQL Server and try this SQL ? I presume the SQL is wrong, it looks odd to me. Do the two tables you're inserting from and to have the same fields in them ? Have you tried rewriting it to work differently ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
This code is just in my .CS file sorry, didnt notice you asked that.
|
|
|
|
|
Great - so long as it's not in the actual code behind, that would be bad design, is all.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
It is in in the actual code behind? How else could it be in the .CS file? I am confused... Been working way to long to answer questions LOL... Going on 100+ hours...
I got it to work...
private void Button1_Click(object sender, System.EventArgs e)<br />
{<br />
<br />
bool bNoError=true;<br />
<br />
OleDbConnection con = new OleDbConnection(strConnection);<br />
string strSQL;<br />
DataSet ds = new DataSet();<br />
<br />
strSQL="UPDATE t_EOT_User set [q1]='"+q1.SelectedValue+"', [q2]='"+q2.Text+"',"+<br />
" [q3]='"+q3.SelectedValue+"', [q4]='"+q4.Text+"', [q5]='"+q5.SelectedValue+"',"+<br />
" [q6]='"+q6.Text+"', [q7]='"+q7.SelectedValue+"', [q8]='"+q8.Text+"',"+<br />
" [q9]='"+q9.SelectedValue+"', [q10]='"+q10.Text+"',"+<br />
" [q11]='"+q11.SelectedValue+"', [q12]='"+q12.Text+"',"+<br />
" [q13]='"+q13.SelectedValue+"', [q14]='"+q14.Text+"',"+<br />
" [q15]='"+q15.Text+"', [q16]='"+q16.Text+"',"+<br />
" [q17]='"+q17.Text+"', [q18]='"+q18.Text+"',"+<br />
" [q19]='"+q19.SelectedValue+"', [q20]='"+q20.SelectedValue+"',"+<br />
" [q21]='"+q21.SelectedValue+"', [q23]='"+q23.Text+"',"+<br />
" [q24]='"+q24.SelectedValue+"', [q26]='"+q26.Text+"',"+<br />
" [q28]='"+q28.Text+"', [q34]='"+q34.SelectedValue+"',"+<br />
" [q35]='"+q35.Text+"', [q38]='"+q38.SelectedValue+"',"+<br />
" [q39]='"+q39.Text+"', [q40]='"+q40.SelectedValue+"',"+<br />
" [q42]='"+q42.Text+"', [q43]='"+q43.SelectedValue+"',"+<br />
" [q44]='"+q44.Text+"', [q45]='"+q45.SelectedValue+"',"+<br />
" [q46]='"+q46.Text+"', [q47]='"+q47.SelectedValue+"',"+<br />
" [q48]='"+q48.Text+"', [q51]='"+q51.SelectedValue+"',"+<br />
" [q52]='"+q52.Text+"', [q53]='"+q53.SelectedValue+"',"+<br />
" [q54]='"+q54.Text+"', [q57]='"+q57.SelectedValue+"',"+<br />
" [q58]='"+q58.Text+"', [q61]='"+q61.Text+"',"+<br />
" [q62]='"+q62.Text+"', [q63]='"+q63.SelectedValue+"',"+<br />
" [q66]='"+q66.SelectedValue+"', [q67]='"+q67.Text+"',"+<br />
" [q70]='"+q70.SelectedValue+"', [q71]='"+q71.Text+"',"+<br />
" [q72]='"+q72.SelectedValue+"', [q73]='"+q73.Text+"',"+<br />
" [q74]='"+q74.SelectedValue+"', [q75]='"+q75.Text+"',"+<br />
" [q84]='"+q84.SelectedValue+"', [q85]='"+q85.Text+"',"+<br />
" [q86]='"+q86.SelectedValue+"', [q87]='"+q87.Text+"',"+<br />
" [q88]='"+q88.SelectedValue+"', [q89]='"+q89.Text+"',"+<br />
" [q90]='"+q90.Text+"', [q91]='"+q91.Text+"',"+<br />
" [q98]='"+q98.SelectedValue+"', [q99]='"+q99.SelectedValue+"',"+<br />
" [q100]='"+q100.Text+"', [q101]='"+q101.SelectedValue+"',"+<br />
" [q102]='"+q102.Text+"', [q103]='"+q103.SelectedValue+"',"+<br />
" [q104]='"+q104.Text+"' WHERE RecNum="+RecNum.Text;<br />
<br />
OleDbDataAdapter da = new OleDbDataAdapter(strSQL,con); <br />
try<br />
{<br />
OleDbCommand cmd = con.CreateCommand();<br />
cmd.CommandText=strSQL;<br />
con.Open();<br />
cmd.ExecuteNonQuery();<br />
}<br />
catch(Exception err)<br />
{<br />
string s= err.Message;<br />
bNoError=false;<br />
}<br />
finally<br />
{<br />
con.Close();<br />
}<br />
<br />
if(bNoError)<br />
{<br />
Response.Redirect("../Common/DataSubmitted.aspx");<br />
}<br />
else<br />
HandleErrors();<br />
}<br />
<br />
}
|
|
|
|
|
OK, your code is in fact in the code behind.
Yes, this will work, but it's not how to produce well written software. Your presentation code should call methods on a dll which contain your buisiness logic and database functionality. This if fine if you're writing something for fun, but if someone is paying for it, or it's going to be put to serious use, this is not how to go about it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I am not a school'd programmer. Infact, this is the first Dot Net website, I have ever done. I am a VB programmer, my jon was eliminated and my company offered me this position. This is how all of the pages that were given to me function. Every piece of code we use in our code behind. I work for the GOVT, we arent allowed to USE SQL server yet!
|
|
|
|
|
Ibuprofen wrote: I am a VB programmer
OK, even in a client VB app, you should use an n-tiered approach.
Ibuprofen wrote: Every piece of code we use in our code behind.
So I gathered. That really, really sucks.
Ibuprofen wrote: we arent allowed to USE SQL server yet!
SQL Server has nothing to do with what I am saying
Ibuprofen wrote: I work for the GOVT
Then your job is probably safe for now, but if you want to be employable in the 'real world', I recommend doing a google on n-tiered architecture and learning how to write this stuff.
I am not schooled either, but if you're self taught, all the more reason to always be looking for things to learn.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I know, that SQL has nothing to do with it. Actually, I wasnt a VB.net programmer, just a VBScript programer did alot of excel / access programering, as well as I wrote alot of instrumentation programs the govt uses to analyze network packets that they collect with there High Speed Lan Taps. I know how to write true VB apps.
Why would you want to compile a whole websites piece of code into a DLL file? I will google it like you said, I am always looking to learn, but this project wasnt mind from the begining, I got given it after someone was working on it for two years, there is lots of devlopment done to it, and there is no way I could go back and change it all is what I was getting at.
|
|
|
|
|
Ibuprofen wrote: Why would you want to compile a whole websites piece of code into a DLL file?
Because that's how it is done - the business logic and data access exist in different assemblies to the presentation layer. In theory, it means different parts can be replaced. This does not happen in the real world. However, it does help with organising the code, nonetheless. Certainly having all the DB code in one place is invaluable. And, using stored procs is even better.
Ibuprofen wrote: there is lots of devlopment done to it, and there is no way I could go back and change it all is what I was getting at.
Well, you may be able to improve new parts at least. Or, at a minimum, learn how to do it, so you can tell your bosses that you're not happy having to work with a monolithic structure, that it will cause maintenance issues in the future, but you have no choice.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Did you look what actually ends up in strSQL? You are likely to spot problem in final query (with user input) then from this code alone. BTW for us here it's impossible to say if your code is ok since we don't know structure of your database.
In addition to what CG said, there is another problem with your code.
Ibuprofen wrote: " [DTG_Submit], [LoginID], [TestPhase]"+
" FROM t_EOT_User WHERE RecNum="+RecNum.Text;
I recon RecNum is Textbox or similar. Now, what happens when user write, for example "1 AND TRUE"? You will end up with all records updated instead of just one. It's serious security hole, known as SQL Injection.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
RecNum is a label, not editable by the user.
|
|
|
|
|
I also have the benefit of having trained users, its for a data collection website, secured on a govt connection, only people from my company have access, and use it.
|
|
|
|
|
I used master/detail view to display records in database. The default add/update option in the detail view uses text box which I changed to template field so that I can use drop down list instead of text box. But the value that I have picked from the drop down list didn't get updated or inserted, is there anything I need to set to make it work.
The following is the code that I have used:
<br />
<asp:TemplateField HeaderText="Progress" SortExpression="Progress"><br />
<EditItemTemplate><br />
<asp:DropDownList ID="ddlProgress" runat="server" DataSourceID="SqlDataSource3" DataTextField="Progress" DataValueField="ProgressID"><br />
</asp:DropDownList><br />
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ConnectionStrings:ExecutiveStatusReportConnectionString %>"<br />
SelectCommand="SELECT [ProgressID], [Progress] FROM [Progress]"></asp:SqlDataSource><br />
</EditItemTemplate><br />
<InsertItemTemplate><br />
<asp:DropDownList ID="ddlProgress" runat="server" DataSourceID="SqlDataSource3"<br />
DataTextField="Progress" DataValueField="ProgressID"><br />
</asp:DropDownList><br />
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ConnectionStrings:ExecutiveStatusReportConnectionString %>"<br />
SelectCommand="SELECT [ProgressID], [Progress] FROM [Progress]"></asp:SqlDataSource><br />
</InsertItemTemplate><br />
<ItemTemplate><br />
<asp:Label ID="Label1" runat="server" Text='<%# Eval("Progress") %>'></asp:Label><br />
</ItemTemplate><br />
</asp:TemplateField><br />
Thanks for any suggestions.
|
|
|
|
|
im coming to asp.net from vb6 where we can code the keypress event. Ive looked at vb.net 2005(asp.net 2.0), i did not see keypress event where i can force numeric enytry in a text box.
Also i want to automatically converts characters as is being entered to uppercase
pls help
t.aransiola
|
|
|
|
|
<asp:TextBox id="txtNumber" Runat="server" />
<asp:RegularExpressionValidator ID="vldNumber" ControlToValidate="txtNumber" Display="Dynamic" ErrorMessage="Not a number" ValidationExpression="(^([0-9]*|\d*\d{1}?\d*)$)" Runat="server">
</asp:RegularExpressionValidator>
|
|
|
|
|