thedeal56
asked on
Trouble Connecting To MSSQL DB Using VB.NET
I get this error when I try to run the attached code:
BC30455: Argument not specified for parameter 'Number' of 'Public Function Str(Number As Object) As String'.
I'm not sure what's up with it. Any ideas? Thanks for reading.
BC30455: Argument not specified for parameter 'Number' of 'Public Function Str(Number As Object) As String'.
I'm not sure what's up with it. Any ideas? Thanks for reading.
---VB---
Imports System.Data.SqlClient
Imports System.Data
Partial Class traf
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim str3 As String
str3 = ConfigurationManager.ConnectionStrings("traffic").ConnectionString()
Dim conn3 As SqlConnection
conn3 = New SqlConnection(str)
Dim sqlSelect3 As String
sqlSelect3 = "SELECT * FROM activecams"
Dim cmd3 As SqlCommand
cmd3 = New SqlCommand(sqlSelect3, conn3)
cmd3.CommandType = CommandType.Text
Dim dr3 As SqlDataReader
Try
conn3.Open()
dr3 = cmd3.ExecuteReader()
If (dr3.HasRow) Then
While dr3.Read()
If dr3("cams") = 19 Then
Label5.Text = "19,19"
End If
End While
Catch ex As Exception
Finally
conn.Close()
End Try
End Sub
End Sub
End Class
----ASP----
<%@ Page Language="VB" MasterPageFile="MasterPage2.master" AutoEventWireup="true" CodeFile="~/trafficcam.aspx.vb" Inherits=traf
Title="Untitled Page" %>
<%@ Register Assembly="Ektron.Cms.Controls" Namespace="Ektron.Cms.Controls" TagPrefix="CMS" %>
<asp:Content ID="Content8" ContentPlaceHolderID="MenuPlaceHolder" runat="Server">
function camName(camnumber) {
switch (camnumber) {
case 1:
camname = "Broad & Mercury";
break;
case 2:
camname = "Broad & Church";
break;
case 3:
camname = "Broad & Main";
break;
case 4:
camname = "Broad & West College";
break;
case 5:
camname = "I-24 & Old Fort";
break;
case 6:
camname = "Old Fort & Chaffin";
break;
case 7:
camname = "Old Fort & Bridge";
break;
case 8:
camname = "Old Fort & Kings Hwy";
break;
case 9:
camname = "NW Broad & Monte Hale";
break;
case 10:
camname = "NW Broad & Thompson";
break;
case 11:
camname = "Memorial & Lokey";
break;
case 12:
camname = "Memorial & Clark";
break;
case 13:
camname = "Memorial & Northfield";
break;
case 14:
camname = "Church & CSX RR";
break;
case 15:
camname = "Church & Middle Tennessee Blvd";
break;
case 16:
camname = "Church & I-24";
break;
case 17:
camname = "Church & Warrior";
break;
case 18:
camname = "Church & Calumet";
break;
case 19:
camname = "Church & Barfield";
break;
default:
camname = "";
break;
}
return (camname);
}
function camOpen(camnumber, camactive) {
if (typeof camwin != 'undefined') { camwin.close(); }
camwin = window.open("", "Camera", "toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=370,height=280");
var vidserv = Math.round((camnumber / 4) + .49);
var cam = camnumber % 4;
if (cam == 0) { cam = 4; }
var ImageResolution = "352x240"; var DisplayWidth = "352"; var DisplayHeight = "240";
var File = "axis-cgi/mjpg/video.cgi?resolution=" + ImageResolution + "&duration=60";
var output = "";
var camname = camName(camnumber);
var Camera = cam;
if (camactive == 0) { Camera = 4; vidserv = 5 }
var BaseURL = "http://traf" + vidserv + ".murfreesborotn.gov/";
if (Camera != "") { File += "&camera=" + Camera; } output = '<html><head><title>Camera ' + camnumber + '</title></head><body><font size="2" face="Verdana, Arial, sans-serif"><STRONG>' + camname + '</STRONG></font><br>';
if ((navigator.appName == "Microsoft Internet Explorer") && (navigator.platform != "MacPPC") && (navigator.platform != "Mac68k")) {
output += "<OBJECT ID=\"CamImage\" WIDTH="
output += DisplayWidth;
output += " HEIGHT=";
output += DisplayHeight;
output += " CLASSID=CLSID:917623D1-D8E5-11D2-BE8B-00104B06BDE3 ";
output += "CODEBASE=\"";
output += BaseURL;
output += "activex/AxisCamControl.cab#Version=1,0,2,15\">";
output += "<PARAM NAME=\"URL\" VALUE=\"";
output += BaseURL;
output += File;
output += "\"> <BR><STRONG>Axis ActiveX Camera Control</STRONG><BR>";
output += "The AXIS ActiveX Camera Control, which enables you ";
output += "to view live image streams in Microsoft Internet";
output += " Explorer, could not be registered on your computer.";
output += "<BR></OBJECT>";
}
else {
output = "<IMG SRC=\"";
output += BaseURL;
output += File;
output += "&dummy=garb\" HEIGHT=\"";
output += DisplayHeight;
output += "\" WIDTH=\"";
output += DisplayWidth;
output += "\" ALT=\"Moving Image Stream\">";
}
output += "</center></body></html>"
//alert(output);
camwin.document.write(output);
}
</script>
<cms:smartmenu id="SmartMenu1" runat="server" defaultmenuid="144" enablemouseoverpopup="True"
stylesheet="vert_popupmenu_workarea_vista.css" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<p align="CENTER">
<asp:label id=label5 Visible=false runat=server Text=""> </asp:label>
<img name="cameramap" src="http://www.murfreesborotn.gov/images/dept/traffic/cameramap.gif"
width="360" height="546" border="0" usemap="#m_cameramap" alt="">
<map name="m_cameramap">
<area shape="rect" accesskey="test" id="test" coords="193,524,225,543" href="javascript:camOpen(<%response.write(label5.text) %>)"
title="Church & Barfield" alt="Church & Barfield">
<area shape="rect" coords="199,469,231,488" href="javascript:camOpen()" title="Church & Calumet"
alt="Church & Calumet">
<area shape="rect" coords="12,169,44,188" href="javascript:camOpen()" title="I-24 & Old Fort"
alt="I-24 & Old Fort">
<area shape="rect" coords="60,178,92,197" href="javascript:camOpen()" title="Old Fort & Chaffin"
alt="Old Fort & Chaffin">
<area shape="rect" coords="106,185,138,204" href="javascript:camOpen()" title="Old Fort & Bridge"
alt="Old Fort & Bridge">
<area shape="rect" coords="176,179,208,198" href="javascript:camOpen()" title="Old Fort & Kings Hwy"
alt="Old Fort & Kings Hwy">
<area shape="rect" coords="199,397,231,416" href="javascript:camOpen()" title="Church & Warrior"
alt="Church & Warrior">
<area shape="rect" coords="229,389,261,408" href="javascript:camOpen()" title="Church & I-24"
alt="Church & I-24">
<area shape="rect" coords="221,283,253,302" href="javascript:camOpen()" title="Church & Samsonite"
alt="Church & Middle Tennessee Boulevard">
<area shape="rect" coords="222,249,254,268" href="javascript:camOpen()" title="Church & CSX RR"
alt="Church & CSX RR">
<area shape="rect" coords="210,178,242,197" href="javascript:camOpen()" title="Broad & Main"
alt="Broad & Main">
<area shape="rect" coords="260,228,292,247" href="javascript:camOpen()" title="Broad & Mercury"
alt="Broad & Mercury">
<area shape="rect" coords="232,202,264,221" href="javascript:camOpen()" title="Broad & Church"
alt="Broad & Church">
<area shape="rect" coords="185,142,217,161" href="javascript:camOpen()" title="Broad & West College"
alt="Broad & West College">
<area shape="rect" coords="220,127,252,146" href="javascript:camOpen()" title="Memorial & Lokey"
alt="Memorial & Lokey">
<area shape="rect" coords="149,71,181,90" href="javascript:camOpen()" title="NW Broad & Monte Hale"
alt="NW Broad & Monte Hale">
<area shape="rect" coords="86,11,118,30" href="javascript:camOpen()" title="NW Broad & Thompson"
alt="NW Broad & Thompson">
<area shape="rect" coords="239,97,271,116" href="javascript:camOpen()" title="Memorial & Clark"
alt="Memorial & Clark">
<area shape="rect" coords="251,60,283,79" href="javascript:camOpen()" title="Memorial & Northfield"
alt="Memorial & Northfield">
</map>
</p>
</asp:Content>
mssql.JPG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I dont find a declaration for str in the code. Are you trying to pass str3?
Also check what is the value of str here
conn3 = New SqlConnection(str)
Also check what is the value of str here
conn3 = New SqlConnection(str)
thedeal56
I assume you have Option Explicit turned off? I thoroughly recommend you turn it back on. The typo would have been immediately obvious had it been on.
To turn it on, go to Tools > Options > Projects and Solutions > VB Defaults.
Wayne
I assume you have Option Explicit turned off? I thoroughly recommend you turn it back on. The typo would have been immediately obvious had it been on.
To turn it on, go to Tools > Options > Projects and Solutions > VB Defaults.
Wayne
ASKER