Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MYSQL to MSSQL

Status
Not open for further replies.

jeellison

IS-IT--Management
May 29, 2002
78
GB
Hello all,

I had the following code working fine using a mysql database and now I have changed it to MSSQL it is not displaying the data?

Does anybody have any ideas why please?

<% If UCase(Recordset1.Fields.Item("engineer_name").Value) = UCase(session("varuser")) Then %>
<span class="display_data_1_NOTES "><%=(Recordset1.Fields.Item("engineer_name").Value)%>
<%end if%>
<% If UCase(Recordset1.Fields.Item("second_engineer").Value) = UCase(session("varuser")) Then %>
<%=(Recordset1.Fields.Item("second_engineer").Value)%>
<%end if%>
<% If UCase(Recordset1.Fields.Item("third_engineer").Value) = UCase(session("varuser")) Then %>
<%=(Recordset1.Fields.Item("third_engineer").Value)%></span>
<%end if%>

Any help will be greatly appreciated.

Best Regards
James
 
Where is the rest of your code (where you open the record set)? Did you try:

<%= Recordset1.Fields.Item("engineer_name").Value %>

and

<%= session("varuser") %>

to see if the data actually exists?

Also, what data types are engineer_name and session("varuser")? You might want to use CStr on both when doing the comparison. Or use the StrComp function.
 
Hello,

Thanks for the reply,

her si all the code:

<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_tynans_mysql_STRING
Recordset1_cmd.CommandText = "SELECT * FROM dbo258758066.tynans_jobs WHERE engineer_name = '" & session("varuser") & "' OR second_engineer = '" & session("varuser") & "' OR third_engineer = '" & session("varuser") & "' "
Recordset1_cmd.Prepared = true

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>


<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<style type="text/css">
<!--
.style1 {color: #999999}
-->
</style>
<link href="tynans.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
background-color: #333333;
}
.style5 {color: #00CC00}
.style6 {color: #FF0000}
.style7 {color: #FFFFFF}
-->
</style></head>

<body>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
<tr>
<td width="1000" height="707" valign="top"><table width="1000" height="25" border="0" cellpadding="0" cellspacing="0" class="header">
<tr>
<td height="25" valign="top"><table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80" height="25">&nbsp;</td>
<td width="606">&nbsp;</td>
<td width="142" class="site_text style3 style1">Tel : 00 44 1942 322950</td>
<td width="172" class="site_text style3 style1">E-mail : Info@tynans.co.uk</td>
</tr>
<tr>
<td height="25">&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2" rowspan="2" class="site_text style3"><label>
<input type="text" name="Search" id="Search" />
</label>
<label>
<input name="Search2" type="submit" class="site_text" id="Search2" value="Search" />
</label></td>
</tr>
<tr>
<td height="25">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="25">&nbsp;</td>
<td colspan="3" valign="top"><span class="site_text">
</span>
<form id="form1" name="form1" method="link" action=" <span class="site_text"><a href="create_a_new_job.asp">New Job</a> |&nbsp;<a href="view_all_jobs.asp">View all Jobs</a>&nbsp;</span><span class="site_text">| </span><span class="site_text"><a href="open_jobs.asp">View Open Jobs</a> | <a href="closed_jobs.asp">View Closed Jobs</a></span> <span class="site_text">| <a href="password_admin.asp">Engineers Administration</a><span class="style7"> |</span> <a href="create_jobsheet.asp">Create Jobsheet</a></span> <span class="site_text">|</span> <span class="site_text"><a href="my_jobs.asp">View My Jobs</a></span> <span class="site_text">|</span> <a href="<%= MM_Logout %>" class="site_text style5 style6">Log Out</a>
</form> </td>
</tr>
</table></td>
</tr>
</table>
<table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1000" height="534" valign="top" class="main_image_1"><table width="1000" height="628" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="20" colspan="3" valign="top"><img src="file:///S|/B&amp;Q/Projects/websites/tynans.co.uk/spacer.gif" width="1" height="1" /></td>
</tr>
<tr>
<td width="15" height="518" valign="top" bgcolor="#2D333F">&nbsp;</td>
<td width="900" height="51alig8" vn="top" class="black_menu1"><p><span class="black_menu_header">Hello <%= session("varuser")%> </span><br />
</p>
<table width="928" height="421" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="30" height="421" valign="top">&nbsp;</td>
<td valign="top" class="solutions_border"><table width="883" height="81" border="0">
<tr>
<td class="display_data_1">Create Jobsheet</td>
<td height="28" class="display_data_1"><div align="center"><strong>Job Number</strong></div></td>
<td class="display_data_2"><div align="center"><strong>Date created</strong></div></td>
<td class="display_data_2"><div align="center"><strong>Reference</strong></div></td>
<td class="display_data_1"><div align="center"><strong>Site</strong></div></td>
<td class="display_data_2"><div align="center"><strong>Contact Name</strong></div></td>
<td class="display_data_2"><div align="center"><strong>Details</strong></div></td>
<td class="display_data_1"><div align="center"><strong>Assigned to</strong></div></td>
<td valign="middle" class="display_data_2"><div align="center"><strong>Status</strong></div></td>
<td class="display_data_1"><div align="center">2nd Engineer</div></td>
<td class="display_data_2"><div align="center">3rd Engineer</div></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<tr>
<td class="display_data_1"><div align="center"><a href="jobsheet.asp?idx=<%= recordset1.Fields.Item("job_number") %>">Create</a></div></td>
<td height="27" class="display_data_1"><div align="center"><%=(Recordset1.Fields.Item("job_number").Value)%></div></td>
<td class="display_data_2"><div align="center"><%=(Recordset1.Fields.Item("job_date").Value)%></div></td>
<td class="display_data_2"><div align="center"><%=(Recordset1.Fields.Item("customer_ref").Value)%></div></td>
<td class="display_data_1"><div align="center"><%=(Recordset1.Fields.Item("site").Value)%></div></td>
<td class="display_data_2"><div align="center"><%=(Recordset1.Fields.Item("contact_name").Value)%></div></td>
<td class="display_data_2"><div align="center"><%=(Recordset1.Fields.Item("job_details").Value)%></div></td>
<td class="display_data_1"><div align="center"><%=(Recordset1.Fields.Item("engineer_name").Value)%></div></td>
<td class="display_data_2"><div align="center"><%=(Recordset1.Fields.Item("job_status").Value)%></div></td>
<td class="display_data_1"><div align="center"><%=(Recordset1.Fields.Item("second_engineer").Value)%></div></td>
<td class="display_data_2"><div align="center"><%=(Recordset1.Fields.Item("third_engineer").Value)%></div></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</table></td>
</tr>
</table></td>
<td width="15" height="518" valign="bottom" bgcolor="#0D0D0D">&nbsp;</td>
</tr>
<tr>
<td height="23" colspan="3" background="images/gradient_solutions_page.gif">&nbsp;</td>
</tr>
<tr>
<td height="23" colspan="3" background="images/gradient_solutions_page.gif">&nbsp;</td>
</tr>
<tr>
<td height="19" colspan="3" valign="middle" background="images/gradient_solutions_page.gif"><div align="center"><span class="site_text style4">Home | Company | Services | Case Studies | Contact Us | Site Map | Online Privacy Policy | Terms of Use | Accessibility | Send Feedback<img src="file:///S|/B&amp;Q/Projects/websites/tynans.co.uk/spacer.gif" alt="" width="1" height="1" /></span></div></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>

<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="site_text"><div align="center">Copyright © 2008 Tynan Elecrical Limited. All rights reserved</div></td>
</tr>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>


It did work all ok just before switching it to a MSSQL.

Its starting to irritate me now :)

Best Regards
James
 
Have you confirmed that the record set is actually opening and that records are returned?

Why is the connection string "MM_tynans_mysql_STRING"? The variable name looks as if it's for MySQL.
 
Hi,

I have this working now but am unsure how. No code has changed but I just rebuilt the user DB.

Thanks
James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top