Jump to content

Matar

Members
  • Posts

    102
  • Joined

  • Last visited

Posts posted by Matar

  1. hi im trying to connect an access database with asp.net there are no error but win i run the page i see a blank page , this is the script <%@ Import Namespace="System.Data.OleDb" %><script runat="server">sub Page_Loaddim dbconn,sql,dbcomm,dbread dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source = " & "C:\Inetpub\wwwroot\webdata\log.mdb")dbconn.Open() sql = "SELECT * FROM stu"dbcomm=New OleDbCommand(sql,dbconn)dbread=dbcomm.ExecuteReader()end sub</script><html><body><form id="Form1" runat="server"><asp:Repeater id="customers" runat="server"><HeaderTemplate><table border="1" width="100%"><tr><th>user</th><th>pass</th></tr></HeaderTemplate><ItemTemplate><tr><td><%#Container.DataItem("user")%></td><td><%#Container.DataItem("pass")%></td></tr></ItemTemplate><FooterTemplate></table></FooterTemplate></asp:Repeater></form></body></html>why ??

  2. hi when u connect asp with db u will use ADO Interface so this scripts connect asp with access db set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/mydb/users.mdb")) set rs = Server.CreateObject("ADODB.recordset")rs.Open "Select * FROM matar", conndo until rs.EOF for each x in rs.Fields Response.Write(x.value ) Response.Write(x.name & "<br />") next rs.MoveNextlooprs.closeconn.closethe first line 2 create a connection var called conn the second line 2 tell asp that the db is access db the third line to establish the connection with the db .. the mydb folder must be locate in the www folder inside the inetpub .. user.mdb the name of the db . the forth line is to create a recordset (DATA READER) form the db ,, rs is a var the fifth line to open the rs connection and get all data from matar table then we make a for loop to get the data form all record the last 2 lines to close the connection with db .GooD Luckmatar

  3. hi how i can retreve a data form two related tables ?i have 2 tables 1 - users table : this table contains the username and password for the users 2 - data table : this table conatins an addtional data about the user .so how i can make a connection to the user table after that the script dedected the data from the data table ???

  4. hi no nothing there like you say there are just all the pages thats stroed in wwwroot and the asp.net pages show with the .aspx extwhat is that ?i setup some options and when i run the pages i see this Server Application Unavailable The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request. Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur. :)

  5. i have a xp windows sp2 this is the code <script runat="server">Sub Page_Load lbl1.Text="The date and time is " & now()End Sub</script><html><body><form runat="server"><h3><asp:label id="lbl1" runat="server" /></h3></form></body></html>thanks

  6. hi i need a code to check if the text box value just letters ,so the user should be enter letters , icheck it for number value and null value but i can't prevent it from acespting the (!@#$%^&*()_=+*") how ?? :)

  7. hi

    I am never the ones with answers... but, in line 9 it saysif(bunny) then... you wouldnt need the () and if bunny what? it doesnt know what you are saying i think.But, like i said, i am not one with all the answers.. but it doesnt seem to make any since to me, not trying to be mean or anything. Since you are using Bunny as a variable, you shouldnt need to use the () and your not telling it anything.
    if bunny = some value then[/coode]that would make more since.thats mean if true ;; its a basic in the programming lang take it in mind  
  8. hi i try this code <%Dim Regex, BunnySet Regex = New RegexpRegex.Global = TrueRegex.Multiline = TrueRegex.IgnoreCase = TrueRegex.Pattern = "^\d+$" Bunny = "matar^"if(bunny) thenResponse.write ("true")elseresponse.write("error")end if%>and i see this errorError Type:Microsoft VBScript runtime (0x800A000D)Type mismatch: '[string: "samer^"]'/test.asp, line 9

  9. hi allthis is a code to serach if this item in my db ,, if exsist this is error ,elseadd it to my db but it doesn't work

    <%dim wh_card1wh_card1 = request.form("wh_card")dim conn1dim rs1dim sql1Set Conn1 = Server.CreateObject("ADODB.Connection")conn1.Provider="Microsoft.Jet.OLEDB.4.0"conn1.Open(Server.Mappath("/webdata/atc.mdb"))set rs1 = Server.CreateObject("ADODB.recordset")      RS1.open "reg",Connsql1 = "select * form reg where wh_card = '"& Request.Form("wh_card") & "'"set RS1 = Conn.Execute(sql1)if  not rs1.eof then response.Redirect ("error.asp?error=duplicate")%><%dim namedim avgdim secdim yerdim soudim schdim gendim mat_studim reldim pobdim dopdim moth_namedim natdim org_coudim addressdim teldim post_adddim podim dad_namedim dad_jobdim dad_reladim work_undim unjob_nodim flag_servdim flagserv_nodim wh_carddim wh_sodim shgdim shg_nodim any_undim any_namedim any_cendim op1dim op2dim op3dim op4name = request.form("name")avg = request.form("avg_sec")sec = request.form("sec_sec")yer = request.form("sec_year")sou = request.form("sec_sou")sch = request.form("last_sch")gen = request.form("gen")mat_stu= request.form("mat_stu")rel = request.form("rel")pob = request.form("pob")dop = request.form("dop")moth_name = request.form("moth_name")nat = request.form("nat")org_cou = request.form("org_cou")address = request.form("address")tel = request.form("tel")post_add = request.form("post_add")po = request.form("po")dad_name = request.form("dad_name")dad_job = request.form("dad_job")dad_rela = request.form("dad_rela")work_un = request.form("work_un")unjob_no = request.form("unjob_no")flag_serv = request.form("flag_serv")flagserv_no = request.form("flagserv_no")wh_card = request.form("wh_card")wh_so = request.form("wh_so")shg = request.form("shg")shg_no = request.form("shg_no")anyun = request.form("any_un")any_name = request.form("any_name")any_cen = request.form("any_cen")op1 = request.form("op1")op2 = request.form("op2")op3 = request.form("op3")op4 = request.form("op4")Dim conn            Dim rs  Set Conn = Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/webdata/atc.mdb"))set rs = Server.CreateObject("ADODB.recordset")      RS.open "reg",Conn,2,2rs.AddNewrs.Fields("Name") = Request.Form("name")rs.Fields("avg_sec") = Request.Form("avg_sec")rs.Fields("sec_sec") = Request.Form("sec_sec")rs.Fields("sec_year") = Request.Form("sec_year")rs.Fields("sec_sou") = Request.Form("sec_sou")rs.Fields("last_sch") = Request.Form("last_sch")rs.Fields("gen") = Request.Form("gen")rs.Fields("mat_stu") = Request.Form("mat_stu")rs.Fields("rel") = Request.Form("rel")rs.Fields("pob") = Request.Form("pob")rs.Fields("dob") = Request.Form("dop")rs.Fields("moth_name") = Request.Form("moth_name")rs.Fields("nat") = Request.Form("nat")rs.Fields("org_cou") = Request.Form("org_cou")rs.Fields("address") = Request.Form("address")rs.Fields("tel") = Request.Form("tel")rs.Fields("post_add") = Request.Form("post_add")rs.Fields("po") = Request.Form("po")rs.Fields("dad_name") = Request.Form("dad_name")rs.Fields("dad_job") = Request.Form("dad_job")rs.Fields("dad_rela") = Request.Form("dad_rela")rs.Fields("work_un") = Request.Form("work_un")rs.Fields("unjob_no") = Request.Form("unjob_no")rs.Fields("flag_serv") = Request.Form("flag_serv")rs.Fields("flagserv_no") = Request.Form("flagserv_no")rs.Fields("wh_card") = Request.Form("wh_card")rs.Fields("wh_so") = Request.Form("wh_so")rs.Fields("shg") = Request.Form("shg")rs.Fields("shg_no") = Request.Form("shg_no")rs.Fields("any_un") = Request.Form("any_un")rs.Fields("any_name") = Request.Form("any_name")rs.Fields("any_cen") = Request.Form("any_cen")rs.Fields("op1") = Request.Form("op1")rs.Fields("op2") = Request.Form("op2")rs.Fields("op3") = Request.Form("op3")rs.Fields("op4") = Request.Form("op4")rs.Updaters.CloseSet rs = NothingSet Conn = NothingResponse.Redirect "thx.asp"%>
    and i see this errorError Type:ADODB.Recordset (0x800A0BB9)Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another./add.asp, line 11what i should do ?
  10. hi i write this code form drop down list this code prevent the user from selecting the same value on 2 list so there are 2 list and there option the same both have 4values red,green,blue,yellowwhen the user choose red from the first list in the second list the red value will hide i need to modfiy this code to work with 4 list this the code

    <script LANGUAGE="JavaScript">var OptLstTxt = new Array;var OptLstVal = new Array;var OptLen = 0;function NoDupl(SelObjFrom, SelObjTo) {var OldToVal = SelObjTo.options[selObjTo.selectedIndex].value;if (OptLen == 0) {OptLen = SelObjFrom.length;for (var i = 1; i < OptLen; i++) {OptLstTxt = SelObjFrom.options.text;OptLstVal = SelObjFrom.options.value;  }}var j = 1;for (var i = 1; i < OptLen; i++) {if (OptLstVal != SelObjFrom.options[selObjFrom.selectedIndex].value) {if (j == SelObjTo.length) {SelObjTo.options[j] = new Option(OptLstTxt);}else {SelObjTo.options[j].text = OptLstTxt;}SelObjTo.options[j].value = OptLstVal;if (OptLstVal == OldToVal) {SelObjTo.selectedIndex = j;}j++;  }}if (SelObjTo.length > j)SelObjTo.options[(SelObjTo.length - 1)] = null;}//  End --></script>Try to select the same color:<br><select name="Color_1" onChange="NoDupl(this,document.form.Color_2)"><option value='Red'>Red</option><option value='yellow'>Yellow</option><option value='Green'>Green</option><option value='Blue'>Blue</option></select><select name="Color_2" onChange="NoDupl(this,document.form.Color_1)"><option value='Red'>Red</option><option value='yellow'>Yellow</option><option value='Green'>Green</option><option value='Blue'>Blue</option></select>
    how can do it ?? :)
  11. hi i write a code thats check if the dropdown menu valuse yes or no if no then no problem if the next field is empty if yes then the next field value must be not empty and the code i wrote doest't work this is my code

    are u marrid <%response.write"<select name = s >"%> <%response.write"<option>yes</option>"%> <%response.write"<option>no</option>"%>  <%response.write"</select>"%> ShowFormField("Number of children")the check<%Function ValidateField(sFieldValue, sFieldType) Dim bFieldIsOkay bFieldIsOkay = True Select Case LCase(sFieldType)  Case "s"  If Not IsNumeric(sFieldValue)  Then   Case "مصدر بطاقة المؤن"  If trim(Len(Number of children)) = 0 Then   bFieldIsOkay = False  End If
    what should the code will be ???????

    ASP

    hi all microsoft products have a spiceal effict ,, but i think asp not a standalone langauge like php , when u work in asp u must use an other microsoft product and when u use asp 100% u must use vbscript ,, then thats depands on the other application u will use it in ut project . for example if use a sql server as a database its more compateble with asp , cause the same company create it , see the major of php sites use the MySql as a database . so all microsoft products easy to learning and more popular .i think this issues enough to use asp . :)

  12. hi try this code and it get all recored

    <%Dim conn            Dim rs  Set Conn = Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/webdata/tst.mdb"))set rs = Server.CreateObject("ADODB.recordset") sql= "SELECT name FROM data, data1 WHERE 'sno = sno1 ' AND 'ven_dor = ven_dor1' AND 'name like ? '"set RS = Conn.Execute(SQL)do until rs.EOF    for each x in rs.Fields Response.Write(x.value ) Response.Write(x.name & "<br />")     next      rs.MoveNextlooprs.closeconn.close%>
    this is the result samerenamesamerenamemohdnamemohdnamei have just 2 field and it is get the both field
  13. hi thnak u its useful linkbut i have problem with this case "agv" If trim(Len(sFieldValue)) = 0 And Not IsNumeric(sFieldValue)Then bFieldIsOkay = Falsethis code doesn't work when the user enter a string its acsept this value its work just when the user let it empty

×
×
  • Create New...