mysql - C# homepage related question. (Request.Querystring["id"]) -


i working on homepage guild come , running in rift in near future, trying finish homepage fast possible.

anyway! program homepages in vb.net , program c# when program applications. become better @ c# choose program homepage in c#.

so heres problem, trying make foreach pulls out database stuff related id in addressbar, if address bar says "showtopics.aspx?id=1" in table in database has number 1 (i use field called fldovertopicid when adds new under topic overtopic gets same number overtopics id.) gets pulled out. though problem seems doesent work vb.net programming does.

so heres code:

in code give method name when write name later in code knows that, thats supposed do. can see ive put 'where fldovertopicid=" + id;' tell code want use fldovertopicid mediator code knows when addressbar number matches fldovertopicid supposed pull out same number.

public datatable getundertopics(int id)     {         string strsql = "select fldid, fldtopicname, fldicon, fldcreator tbltopics fldovertopicid=" + id;         mysqlcommand objcmd = new mysqlcommand(strsql);          return _objdata.getdata(objcmd, _con);     } 

this backend code want pull out topics. im trying tell here if number in addressbar 1 supposed pull out content have 1 in fldovertopicid. problem. when made piece of code got 2 errors:

  1. the best overloaded method match 'forumfac.getundertopics(int)' has invalid arguments

  2. argument 1: cannot convert 'string' 'int'

        forumfac objfac = new forumfac();      foreach (datarow row in objfac.getundertopics(request.querystring["id"]).rows)     {     } 

hopefully able explain problem enough.

thanks in advance

use objfac.getundertopics(int.parse(request.querystring["id"]))

you making invalid call method takes int argument. querystring parameters strings. int.parse(string) converts value string integer or throws exception if string not integer. there tryparse(string, out int) method returns whether or not string converted , not throw exception.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -