|
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>
|
|
|
|
|
You have a keypress event if you do VB.NET in windows, but as you're doing ASP.NET, these events happen on the client, in javascript, not on the server, in VB. If you google, there are lots of examples of javascript scripts that you can run via the key pressed event on the client end to do what you're after.
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 have some surveys/questionnaires, that are rather long, some as long as 105 questions. The user is timing out before he can finish filling it out completely.
|
|
|
|
|
Timing out, how ? If they can see the whole thing, there shouldn't be any timeout while they are filling it in. 105 items doesn't seem like a lot to load, either ?
Perhaps you need to break it over several pages ?
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 want to send SMS via ASP.NET Web Service.. Any One plz help me to write coding in C# code behind file...
|
|
|
|
|
Try using Google to search for Sending SMS With ASP.Net[^]
" 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
|
|
|
|
|
Hi,
When the users upload a picture to my server using file upload control, i want to change uploaded picture's size programmaticly. how can i do that ? and the pictures will stay in my server after i change their sizes...
atarikg
Regards...
|
|
|
|
|
try here: http://aspnet.4guysfromrolla.com/articles/012203-1.aspx
|
|
|
|
|
Thanks man
|
|
|
|
|
Hi All,
How to export the data into excel file
Manoj Bisht
|
|
|
|
|
There is Article in CP Export Data into Excel[^] by Rama Krishna Kolluri.
Hope this article will help you.
Regards,
Satips.
|
|
|
|
|
How can I pass the value from texbox.text as parameter in my SQL query?
Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim txt As Integer
Dim updateCMD As SqlCommand
Dim query As String
txt = TextBox1.Text
query = "UPDATE [Temp] SET [value] = '??????' WHERE [name] = 'temprature'"
updateCMD = New SqlCommand(query, SQLconn)
updateCMD.CommandType = CommandType.Text
SQLconn.Open()
updateCMD.ExecuteNonQuery()
SQLconn.Close()
End Sub
Thanks
|
|
|
|
|
Modify query like this:
query = "UPDATE [Temp] SET [value] = @text WHERE [name] = 'temprature'"
Add this:
updateCMD.Parameters.AddWithValue("@text", Textbox1.Text);
|
|
|
|
|
Have you tried this :
----------------------------------------------
query = "UPDATE [Temp] SET [value] = '" + txt + "' WHERE [name] = 'temprature'"
Regards,
Mayank Parmar
Senior Software Engineer
Amba Tech
Gandhinagar, India
|
|
|
|
|
The first method by szukuro worked...
When I use this I get a error about converting data from char to integer probably because the data type in database is a Integer.
query = "UPDATE [Temp] SET [value] = '" + txt + "' WHERE [name] = 'temprature'"
Thanks guys.
|
|
|
|