473,386 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

connect to sql server 2005 problem

I want to retrieve data from sql server 2005 after clicking a button
so I do this code but it not work any help please
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.  
  4.     </head>
  5.     <body>
  6.         <%
  7.             dim conn
  8.             dim strconn ="Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MailSystem;Data Source=."
  9.             Set cnt =Server.CreateObject("ADODB.Connection")
  10.             cnt.ConnectionString= strconn
  11.             cnt.Open
  12.         %>
  13.         <form method="Post">
  14.             Enter Search Name <Input type="text" name="First"/> 
  15.             <select name="Filter">
  16.                 <option>And</option>
  17.                 <option>Or</option>
  18.             </select>
  19.             <Input type="text" name="Second"/>
  20.             <Input type="Submit" value="Search" name="Search"/>
  21.         </form>
  22.         <% if  Request.Form("Second")<>"" then
  23.                 sql="exec selectMesseges1'" & First & "','" & Filter & "','" & Second & "'"
  24.             else
  25.                 sql="select *  from MessegesIDTable where subject like '" & First & "'+'%'"
  26.  
  27.             set rs=Server.CreateObject("ADODB.Recordset")
  28.             rs.Open sql,cnt
  29.  
  30.  
  31.         %>
  32.     <table width="100%" cellspacing="0" cellpadding="2" border="1">
  33.    <tr>
  34.      <th>ID</th>
  35.      <th>MailFrom</th>
  36.      <th>ToID</th>
  37.      <th>subject</th>
  38.      <th>messege</th>
  39.      <th>AttachedFile</th>
  40.      <th>date</th>
  41.      <th>read</th>
  42.      <th>typeID</th>
  43.    </tr>
  44.    <%
  45.     do until rs.EOF
  46.            response.write("<tr>")
  47.            response.write("<td>" & rs.fields("ID") & "</td>")
  48.            response.write("<td>" & rs.fields("MailFrom") & "</td>")
  49.            response.write("<td>" & rs.fields("ToID") & "</td>")
  50.            response.write("<td>" & rs.fields("subject") & "</td>")
  51.            response.write("<td>" & rs.fields("messege") & "</td>")
  52.            response.write("<td>" & rs.fields("AttachedFile") & "</td>")
  53.            response.write("<td>" & rs.fields("date") & "</td>")
  54.            response.write("<td>" & rs.fields("read") & "</td>")
  55.            response.write("<td>" & rs.fields("typeID") & "</td>")
  56.            response.write("</tr>")
  57.            rs.MoveNext
  58.     loop
  59.     rs.close
  60.     conn.Close
  61.     set rs=Nothing
  62.     set conn=Nothing%>
  63.     </table>
  64.  <%  end if %>
  65.     </body>
  66. </html>
Dec 21 '08 #1
1 1437
CroCrew
564 Expert 512MB
Look at line 13: <form method="Post">

The <form> needs an action like this:

<form name="xForm" action="Index.asp" method="post">

The action tells where to post the form too.

Hope this helps,
CroCrew~
Dec 23 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: ~john | last post by:
I just installed PHP 5.1.4 with SQL Server 2005 on my laptop. PHP is running fine and so is SQL Server 2005. When I try to connect to SQL Server from my my PHP code I get this error. Warning:...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
6
by: RAM | last post by:
Hello, Could you help me please to solve the prblem with connecting to SQL Server from .NET development environment? I have the following error: "An error has occured while establishing a...
13
by: josh | last post by:
I'm pretty new to both sql 2005 and VB but please bear with me. I have installed SQL 2005 express on a Windows 2003 Standard server. I have also installed VB 2005 Express edition on the server. SQL...
0
by: tamayi | last post by:
I have a problem (like most others posting issues on this forum :) ) I have a remote server running Windows XP SP2, with both SQL Server 2005 Express with Advanced Features and SQL 2000...
1
by: rubeel | last post by:
I cannot seem to connect to this Instance locally which was i able to in the past. I can connect to the instance from out side. The instance is running and the DBs in the instance are available and...
5
by: Alan Silver | last post by:
Hello, Server configuration: Windows 2003 Server SP2 SQL Server 2000 SP4 ..NET v2.0.50727 just built up a new server using the same configuration as my current one. I even used the same CDs...
9
by: Peter Lux | last post by:
I'm fairly new to c#, but not new to programming. I'm tasked with rewriting our Gupta/Sqlwindows apps (5 years worth of development) in dot Net. The main reason is that virtually no one knows the...
8
by: BD | last post by:
I am developing C# win form app to work with remote database on SQL Server 2005. Problem scenario is as follows: 1. a form is open that has downloaded dataset to local cache 2. computer is...
7
by: RN1 | last post by:
Is it possible to connect to my local SQL Server 2005 database from a remote web server? If yes, what ConnectionString do I use? Thanks, Ron
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.