Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Yahweh

  • Rank
  1. To improve the signal to noise ratio on this forum, here is a brief list of things to delete on sight:- Any threads with the phrases "help me" or "please help me" in the title- Any thread titles that can be matched with the regex "help(!{2,})"- Any posts that says "I have an error in my code, [insert ambiguous error message], how do I fix it?" without corresponding sourcecode.- More than 10 lines of sourcecode that does not appear in the CODE tag || more the 3 lines of PHP outside of code tags.- Any post asking for replies by email rather than in the forum.- Any post asking for something absurd like "please give me the full source of MP3.com".- All posts in the VBScript forum. Clientside VBScript is dead.Addendum:If you choose to improve the signal to noise ratio as I've suggested above, also be sure to delete the "hey! why was my post deleted" posts.
  2. You're out of luck, Suganya, there's no function (at least not an elegant function) to remove alpha characters. You should probably do it programmatically. That expression is too complicated, and it doesn't match strings like "hello324234". You don't need to capture anything, just remove the unwanted characters:preg_replace('[^\d]', '', COLUMN_VALUE)
  3. declare @lastID intINSERT INTO Customer (columns) VALUES (values);set @lastID = scope_identity()INSERT INTO Voucher(CustomerID) VALUES (@lastID);
  4. Yes. You have a bug in your code. Post your code so people can debug it.
  5. You're not expecting your page changes to be reflected on Google instantaneously do you? Depending on the popularity of your site, Google can reindex your site in a couple of days, or it might take a couple of weeks.And if you don't want anyone to see your backup pages, then delete them.
  6. Yahweh

    Automatic insert

    It would be nice to see the code on the page you're trying to submit. I can't think of any reason why the submit button would need to be pressed, unless you're assigning your variables like this:someVar = Request.Form("something") You aren't required to use Request.Form, you can use this instead: someVar = Request("something") So, when a user visits your page, you can put something like this at the top: dim user, monkey, IPAddress, sql'Initializing and escaping variablesuser = Replace(request("user"), "'", "'')monkey = Replace(request("monkey"), "'", "'')IPAddress = Replace(Request.ServerVariables("REMOTE_ADDR"), "'", "'')'Putting them into an SQL statementsql = "INSERT INTO table (user, monkey, IP) values ('[user]', '[monkey]', '[ipAddress]')"sql = replace(sql, "[user]", user, 1, -1, vbTextCompare)sql = replace(sql, "[monkey]", monkey, 1, -1, vbTextCompare)sql = replace(sql, "[IPAddress]", IPAddress, 1, -1, vbTextCompare)'Executing statementConn.Open someDSNConn.Execute(sql)Conn.Close
  7. That code works perfectly fine in .Net 2.0+. It won't work in 1.1. Upgrade to the latest .Net framework and change your website's configuration through IIS to use .Net 2.0.
  8. You don't have a class called "net.ListArticleSortable" in your codebehind, so you can't inherit from it. You can only inherit from the class defined on your codebehind:Note that the class on the codebehind inherits from System.Web.UI.Page. If you don't have that, then ASP.Net doesn't have any of the requisite information it needs to build the page, so you'll get errors.
  9. An inner join combines the rows of one table with all of the rows of another table. So if you have more than one row on your stones table, then you're going to return duplicate entries on your models table.A left join returns only non-null rows in the table to the left of the join operator, which means you only get one row returned per model in your models table. You obviously should use a left join instead:SELECT models.idModel, models.name, Sum(stones.size) AS BTEFROM modelsLEFT JOIN modelStones ON (models.idModel = modelStones.idModel)LEFT JOIN stones ON modelStones.idStone = stones.idStoneGROUP BY models.idModel, models.name;
  10. Yahweh

    sort array C#

    The FileInfo class doesn't implement the IComparable interface, so you can't use the Array.Sort method directly on it. You have to create your own class and implement the IComparer interface (<--- you won't implement the IComparable interface because FileInfo isn't inheritable).Create a class called SortFileInfo:Imports System.IOPublic Class SortFileInfo Implements IComparer Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare Dim file1, file2 As FileInfo file1 = CType(x, FileInfo) file2 = CType(y, FileInfo) 'change the .Name attribute if you want to sort by any other property Return String.Compare(file1.Name, file2.Name) End FunctionEnd Class Now you can sort your array based on name: Dim di As New DirectoryInfo("C:\") Dim rgFiles As FileInfo() rgFiles = di.GetFiles("*") Array.Sort(rgFiles, New SortFileInfo) For Each file As FileInfo In rgFiles TextBox1.AppendText(file.Name) TextBox1.AppendText(vbNewLine) Next
  11. Its not correct, it produces invalid HTML. The resulting HTML will look like this:<input name="RecievedNotification" type="checkbox" id="RecievedNotification" value = "" />or<input name="RecievedNotification" type="checkbox" id="RecievedNotification" value = "checked="checked"" /> That's obviously not right because value and checked are two distinct attributes.You want this instead: <input name="RecievedNotification" type="checkbox" id="RecievedNotification" value="y" <%If RecievedNotification = "-1" Then Response.Write("checked=""checked""") : Response.Write("")%>" />
  12. Yahweh

    Security Questions

    If your creating stored procedures, then you only need to fill your command object with the correct parameters and SQL Server will take care of the rest.Otherwise, if you're creating dynamic queries or your queries are embedded in JScript, then escape single quotes (') and double quotes ("). If you're using another database like MySQL, then you should escape backslashes (\) too.
  13. Download SQL Server Management Studio Express. Its a very good piece of software for being free.
  14. Use INSERT...SELECT syntax. Assuming you have a Messages table and a Users table.INSERT INTO Messages(UID, Body)SELECT UID, 'Have a Good morning, user' + UID From Users where UID IN (@list_of_users)
  15. Yahweh

    Search.asp.cs in C#

    Its not too terribly complicated. The only significant part of the search is your SQL query. The way you design your query depends on whether your table has a fulltext index. I'll presume it doesn't for simpliicity.If you're using SQL server, then create a stored procedure like this:Create procedure Find_Users(@username varchar(50))AsSelect * from users where username = @username/*If you want to match partial names, then use this instead:Select * from users where username like '%' + @username + '%'*/ I assume your want your records displayed in a gridview, with a search textbox and search button at the top. The basic markup for Search.aspx will contain a textbox, a search button, a gridview, and an SQL datasource. The textbox will be bound to one of the select parameters of your SQL datasource. The final product will look something like this: <asp:TextBox ID="txtSearch" runat="server"></asp:TextBox> <asp:Button ID="btnSearch" runat="server" Text="Search" /><br /> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="sqlSearch"> <Columns> <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" /> <asp:BoundField DataField="username" HeaderText="username" SortExpression="username" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="sqlSearch" runat="server" ConnectionString="<%$ ConnectionStrings:ASPNetConnectionString %>" SelectCommand="Find_Users" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:ControlParameter ControlID="txtSearch" Name="username" PropertyName="Text" /> </SelectParameters> </asp:SqlDataSource> You don't need any code in your code behind, because txtSearch is bound to one of your select parameters. When you click search, the page will automatically display all of the records that match the user you're searching for.
  • Create New...