| | |
Asp.net behind code not correct
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Feb 2009
Posts: 54
Reputation:
Solved Threads: 0
hi,
there, im coming up with codes to connect asp.net interface(Track) with asp.net interface(Clerk). i am not sure if my codes are correct. at the same time, i am not sure how to write codes to write the select statement which can connect asp.net interface with sql server. please help.
there, im coming up with codes to connect asp.net interface(Track) with asp.net interface(Clerk). i am not sure if my codes are correct. at the same time, i am not sure how to write codes to write the select statement which can connect asp.net interface with sql server. please help.
ASP.NET Syntax (Toggle Plain Text)
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" %> <%@Import NameSpace="System.Data" %> <%@ Import Namespace="System.Data.SqlClient" %> <%@ Import Namespace="System.Configuration" %> <script runat="server"> Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim MyConnection As SqlConnection Dim MyCommand As SqlCommand Dim MyReader As SqlDataReader MyConnection = New SqlConnection() MyConnection.ConnectionString = _ ConfigurationManager.ConnectionStrings("ConnectionString2").ConnectionString Dim str As String = "insert into track(TrackingID,PickDATE,Consignment,Reference,Origin,Destination,Status,Destination,RecipientName) Values('" &TextBox1.Text& "','"&TextBox2&"','"&TextBox3.Text&"','" &TextBox4.Text& "','" &TextBox5.Text& "','" &TextBox6.Text& "','" &TextBox7.Text& "','" &TextBox8.Text& "');" Dim Command As SqlCommand = "Select TrackingID.Track from Clerk where (TrackingID.Track=TrackID.Clerk) " MyCommand = New SqlCommand MyCommand.CommandText = "Select " MyCommand.CommandText = MyCommand.CommandText + "'" MyCommand.CommandText = MyCommand.CommandText + "'" MyCommand.CommandText = MyCommand.CommandText MyCommand.Connection = MyConnection MyCommand.Connection.Open() MyReader = MyCommand.ExecuteReader() MyCommand.Dispose() MyConnection.Dispose() End Sub </script>
Last edited by Ezzaral; Apr 16th, 2009 at 11:14 pm. Reason: Added code tags. Learn to use them.
•
•
Join Date: Apr 2008
Posts: 114
Reputation:
Solved Threads: 6
where are you using this:
ASP.NET Syntax (Toggle Plain Text)
Dim str As String = "insert into track(TrackingID,PickDATE,Consignment,Reference,Origin,Destination,Status,Destination,RecipientName) Values('" &TextBox1.Text& "','"&TextBox2&"','"&TextBox3.Text&"','" &TextBox4.Text& "','" &TextBox5.Text& "','" &TextBox6.Text& "','" &TextBox7.Text& "','" &TextBox8.Text& "');"
•
•
Join Date: Feb 2009
Posts: 54
Reputation:
Solved Threads: 0
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" %>
<%@Import NameSpace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Configuration" %>
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Redirect("Clerk")
Dim MyConnection As SqlConnection
Dim MyCommand As SqlCommand
Dim MyReader As SqlDataReader
MyConnection = New SqlConnection()
MyConnection.ConnectionString = _
ConfigurationManager.ConnectionStrings("ConnectionString2").ConnectionString
Dim str As String = "insert into Track(TrackingID,PickDATE,Consignment,Reference,Origin,Destination,Status,Destination,RecipientName) Values('" &TextBox1.Text& "','" &TextBox2& "','" &TextBox3.Text& "','" &TextBox4.Text& "','" &TextBox5.Text& "','" &TextBox6.Text& "','" &TextBox7.Text& "','" &TextBox8.Text& "');"
MyCommand = New SqlCommand
MyCommand.CommandText = MyCommand.CommandText + "'"
MyCommand.CommandText = MyCommand.CommandText + "'"
MyCommand.CommandText = MyCommand.CommandText
MyCommand.Connection = MyConnection
MyCommand.Connection.Open()
MyReader = MyCommand.ExecuteReader()
MyCommand.Dispose()
MyConnection.Dispose()
End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<p>
<br />
</p>
<p>
</p>
<p>
TRACK MY SHIPMENT</p>
<p>
</p>
<p>
</p>
<p>
Tracking ID
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</p>
<p>
</p>
<p>
<asp:Button ID="Button1" runat="server" Text="TRACK" Width="96px" />
</p>
<p>
</p>
<p>
PICK UP
DATE CONSIGNMENT
REFERENCE
ORIGIN DESTINATION
STATUS
RECIPIENT NAME</p>
<p>
<asp:TextBox ID="TextBox2" runat="server" Height="42px" Width="93px"></asp:TextBox>
<asp:TextBox ID="TextBox3" runat="server" Height="42px" Width="93px"></asp:TextBox>
<asp:TextBox ID="TextBox4" runat="server" Height="42px" Width="93px"></asp:TextBox>
<asp:TextBox ID="TextBox5" runat="server" Height="42px" Width="93px"></asp:TextBox>
<asp:TextBox ID="TextBox6" runat="server" Height="42px" Width="93px"></asp:TextBox>
<asp:TextBox ID="TextBox7" runat="server" Height="42px" Width="93px"></asp:TextBox>
<asp:TextBox ID="TextBox8" runat="server" Height="42px" Width="93px"></asp:TextBox>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<asp
qlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
SelectCommand="Select TrackingID from [Clerk] where TrackingID=NationWideAccount"></asp
qlDataSource>
<asp
qlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
SelectCommand="Select TrackID from [Clerk],[PickUpForm] where PickDATE=PickUp,Consignment=Consignment,Reference=TrackingID,Origin=Address,Destination=Location,Status=Status,RecipientName=RecipientName "></asp
qlDataSource>
</asp:Content>
<%@Import NameSpace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Configuration" %>
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Redirect("Clerk")
Dim MyConnection As SqlConnection
Dim MyCommand As SqlCommand
Dim MyReader As SqlDataReader
MyConnection = New SqlConnection()
MyConnection.ConnectionString = _
ConfigurationManager.ConnectionStrings("ConnectionString2").ConnectionString
Dim str As String = "insert into Track(TrackingID,PickDATE,Consignment,Reference,Origin,Destination,Status,Destination,RecipientName) Values('" &TextBox1.Text& "','" &TextBox2& "','" &TextBox3.Text& "','" &TextBox4.Text& "','" &TextBox5.Text& "','" &TextBox6.Text& "','" &TextBox7.Text& "','" &TextBox8.Text& "');"
MyCommand = New SqlCommand
MyCommand.CommandText = MyCommand.CommandText + "'"
MyCommand.CommandText = MyCommand.CommandText + "'"
MyCommand.CommandText = MyCommand.CommandText
MyCommand.Connection = MyConnection
MyCommand.Connection.Open()
MyReader = MyCommand.ExecuteReader()
MyCommand.Dispose()
MyConnection.Dispose()
End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<p>
<br />
</p>
<p>
</p>
<p>
TRACK MY SHIPMENT</p>
<p>
</p>
<p>
</p>
<p>
Tracking ID
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</p>
<p>
</p>
<p>
<asp:Button ID="Button1" runat="server" Text="TRACK" Width="96px" />
</p>
<p>
</p>
<p>
PICK UP
DATE CONSIGNMENT
REFERENCE
ORIGIN DESTINATION
STATUS
RECIPIENT NAME</p>
<p>
<asp:TextBox ID="TextBox2" runat="server" Height="42px" Width="93px"></asp:TextBox>
<asp:TextBox ID="TextBox3" runat="server" Height="42px" Width="93px"></asp:TextBox>
<asp:TextBox ID="TextBox4" runat="server" Height="42px" Width="93px"></asp:TextBox>
<asp:TextBox ID="TextBox5" runat="server" Height="42px" Width="93px"></asp:TextBox>
<asp:TextBox ID="TextBox6" runat="server" Height="42px" Width="93px"></asp:TextBox>
<asp:TextBox ID="TextBox7" runat="server" Height="42px" Width="93px"></asp:TextBox>
<asp:TextBox ID="TextBox8" runat="server" Height="42px" Width="93px"></asp:TextBox>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<asp
qlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"SelectCommand="Select TrackingID from [Clerk] where TrackingID=NationWideAccount"></asp
qlDataSource><asp
qlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"SelectCommand="Select TrackID from [Clerk],[PickUpForm] where PickDATE=PickUp,Consignment=Consignment,Reference=TrackingID,Origin=Address,Destination=Location,Status=Status,RecipientName=RecipientName "></asp
qlDataSource></asp:Content>
•
•
Join Date: Apr 2008
Posts: 114
Reputation:
Solved Threads: 6
your creating this string:
doesnt appear to be used any where -
give something like this a try:
ASP.NET Syntax (Toggle Plain Text)
Dim str As String = "insert into Track(TrackingID,PickDATE,Consignment,Reference,Origin,Destination,Status,Destination,RecipientName) Values('" &TextBox1.Text& "','" &TextBox2& "','" &TextBox3.Text& "','" &TextBox4.Text& "','" &TextBox5.Text& "','" &TextBox6.Text& "','" &TextBox7.Text& "','" &TextBox8.Text& "');"
doesnt appear to be used any where -
give something like this a try:
ASP.NET Syntax (Toggle Plain Text)
dim connectionstring = SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString2").ConnectionString) Dim str As String = "insert into Track(TrackingID,PickDATE,Consignment,Reference,Origin,Destination,Status,Destination,RecipientName) Values('" &TextBox1.Text& "','" &TextBox2& "','" &TextBox3.Text& "','" &TextBox4.Text& "','" &TextBox5.Text& "','" &TextBox6.Text& "','" &TextBox7.Text& "','" &TextBox8.Text& "');" Dim scomm As Sqlcommand(str,connectionstring) Dim MyReader As SqlDataReader scomm = scomm.ExecuteReader()
Please mark this post as 'Solved' if it has helped and fixed your issue.
![]() |
Similar Threads
- Updated : Simple ASP.Net Login Page (ASP.NET)
- Asp.net code for sending email (Visual Basic 4 / 5 / 6)
- how to run asp.net pages using apache (ASP.NET)
- How is 3Tier architecture implemented in ASP.NET (ASP.NET)
- Simple ASP.Net Login Page (Using VB.Net) (ASP.NET)
- ASP.NET: Problems with CustomValidator... (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: error in the programming code
- Next Thread: how to create a dynamic dropdownlist?
| Thread Tools | Search this Thread |
.net 3.5 ajax alltypeofvideos appliances asp asp.net bc30451 beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions control countryselector dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol expose fileuploader fill findcontrol flash formatdecimal formview gridview gudi iis javascript list listbox login microsoft mouse mssql nameisnotdeclared news novell numerical opera panelmasterpagebuttoncontrols problem radio redirect registration relationaldatabases reportemail save schoolproject search security sessionvariables silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos vista visualstudio vs2008 web webapplications webdevelopemnt webdevelopment webprogramming webservice wizard xsl youareanotmemberofthedebuggerusers





