|
hello
someone can help me
i have a CustomerDS typed
i learn with the "http://msdn.microsoft.com/practices/apptype/webapps/default.aspx?pull=/library/en-us/dnpag/html/diforwc-ap02.asp#diforwc-ap02_plag_howtodesigncrudform"
so in my data access component ican´t instance CustomerDs.Customer
i have the follow option CustomerDS.CustomerDataTable
CustomerDS.CustomerDataRow
i don´t know why?
' Return the customer with the specified ID
Public Function GetById(customerId As Integer) As CustomerDs.Customer
Try
Dim customer As New CustomerDs()
' Execute the "select single entity" stored procedure
Dim reader As SqlDataReader = SqlHelper.ExecuteReader(Me.connectionStr, "Customer_SelectByID", customerId)
Try
' Populate the dataset with reader rows
SQLHelperExtension.Fill(reader, customer, customer.Customers.TableName, 0, 1)
Finally
reader.Dispose()
End Try
' Return the first row
Return customer.Customers(0)
Catch e As SqlException
Throw New TechnicalException(Me.ResourceMgr.GetString("TechnicalException.CantGetCustomer", System.Globalization.CultureInfo.CurrentUICulture), e)
End Try
End Function 'GetById
|
|
|
|
|
Can u Please explain ur problem again in the same thread.
|
|
|
|
|
hello
thanks for the time
first all the function getbyid en the articel return CustomerDS.Customer
i cant return CustomerDS.Customer
i know why i dont return CustomerDS.Customer
in my function i have Public Function GetById(customerId As Integer) As CustomerDs
SQLHelperExtension.Fill i can't use SQLHelperExtension this instruccion give me a error. i have imports application block
the function in the article is
' Return the customer with the specified ID
Public Function GetById(customerId As Integer) As CustomerDs.Customer
Try
Dim customer As New CustomerDs()
' Execute the "select single entity" stored procedure
Dim reader As SqlDataReader = SqlHelper.ExecuteReader(Me.connectionStr, "Customer_SelectByID", customerId)
Try
' Populate the dataset with reader rows
SQLHelperExtension.Fill(reader, customer, customer.Customers.TableName, 0, 1)
Finally
reader.Dispose()
End Try
' Return the first row
Return customer.Customers(0)
Catch e As SqlException
Throw New TechnicalException(Me.ResourceMgr.GetString("TechnicalException.CantGetCustomer", System.Globalization.CultureInfo.CurrentUICulture), e)
End Try
End Function 'GetById
|
|
|
|
|
Hi,
I have a FormView that is bound to an SQLDataSource.
The FormView displays the values taken from the SQLDatasource in tags like this:
<br />
<asp:Label ID="NameLabel1" runat="server" Text='<%# Bind("Name") %>'></asp:Label><br />
<asp:Label ID="AddressLabel" runat="server" Text='<%# Bind("Address") %>'></asp:Label>
Now the Address value has linebreaks in it, however of course these linebreaks to not translate to linebreaks in HTML, so I have a function to do this:
<br />
' Function BreakMe<br />
' This function replaces the line break character - Chr(10) - into<br />
' the HTML line break tag <br><br />
Function BreakMe(ByVal strString As String)<br />
Dim strSearchFor As String = Chr(10)<br />
Dim strReplaceWith As String = "<br>"<br />
If InStr(strString, strSearchFor) Then<br />
Dim strBreaked As String = Replace(strString, strSearchFor, strReplaceWith)<br />
Return strBreaked<br />
Else<br />
Return strString<br />
End If<br />
End Function<br />
How can I pass the Address value to my function before it is assigned to the Label?
|
|
|
|
|
Hi there,
You can call the BreakMe method in the data binding express, but the Bind method cannot be used in this context, and you use the Eval instead. Something looks like:
Text='<%# BreakMe(CType(Eval("Address"),string)) %>'
|
|
|
|
|
Thankyou! That works perfectly.
I was trying something very similar, but using the Bind method - but of course it makes sense to use Eval in this context.
|
|
|
|
|
Hi,
I have a problem with a simple Composite Control I am trying to make.
It's in fact a superclassed control.
My projectname is SortedTextBox. My testapp is TestSortedTextBox.
SortedTextBox:
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls
<toolboxdata("<{0}:sortedtextbox runat="server">")>
_
Public Class SortTextBox
Inherits System.Web.UI.WebControls.TextBox
Public Sub Sort()
Dim arrText As String()
arrText = Me.Text.Split(" ")
Array.Sort(arrText)
Me.Text = String.Join(" ", arrText)
End Sub
End Class
In my TestSortedTextBox I have to following html:
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb" Inherits="TestSortedTextBox.WebForm1"%>
<%@ Register TagPrefix="Custom" NameSpace="SortedTextBox"
Assembly="SortedTextBox" %>
<title>WebForm1
<custom:sortedtextbox id="SrtText"
runat="server">
When I Build the project, it builds fine. However, when I want to
visualize the control (design view in VS.Net 2003) in
TestSortedTextBox, the control says "Error creating control". When I
run the project, of course I get an error at <custom:sortedtextbox
id="srttext" runat="server"> in Internet Explorer.
What do I forget? What do I do wrong?
|
|
|
|
|
Do you see the error details in the design view (or when you hover the error control)?
|
|
|
|
|
Yes, it's : Parser Error Message: Could not load type RedText.RedText from assembly RedText, Version=1.0.2459.29417, Culture=neutral, PublicKeyToken=null
|
|
|
|
|
What is the type RedText? I don't see it in your sample code, I think you may want to double check this type. Are you sure that this type is defined in the assembly RedText?
|
|
|
|
|
Sorry, other project, but in my 'redtext' project I have the same problem. This is the error on SortedTextBox: "Parser Error Message: Could not load type SortedTextBox.SortedTextBox from assembly SortedTextBox, Version=1.0.2460.14047, Culture=neutral, PublicKeyToken=null"
Here is the VB code again. Now I checked "Ignore HTML Text in this message" checkbox of this editor. It first 'eated' my HTML text, so the first code-snippet might be confusing for you.
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls
<ToolboxData("<{0}:SortedTextBox runat=server></{0}:SortedTextBox>")> _
Public Class SortTextBox
Inherits System.Web.UI.WebControls.TextBox
Public Sub Sort()
Dim arrText As String()
arrText = Me.Text.Split(" ")
Array.Sort(arrText)
Me.Text = String.Join(" ", arrText)
End Sub
End Class
Here is the html again:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="TestSortedTextBox.WebForm1"%>
<%@ Register TagPrefix="Custom" NameSpace="SortedTextBox" Assembly="SortedTextBox" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<Custom:SortedTextBox id="SrtText" runat="server" />
</form>
</body>
</HTML>
|
|
|
|
|
And so I have this over and over again: when I try to explain the problem to somebody else, I very often see the solution while explaining:
vb-code:
Public Class SortTextBox....
html-code:
<Custom:SortedTextBox....
It should be:
<Custom:SortTextBox....
So, the conclusion is that the name after "custom:" must be exact as the class-name. I first thought it should be the projectname. Wrong thinking...
Anyway, thanks for listening to me!
|
|
|
|
|
You found this before I posted my reply and in case that you're not familiar with this stuff, you can have a look at the Register directve on the web page to get more information. Basically, in the Register directive you can specify:
+ The TagPrefix like Custom
+ The Namespace containing the control class.
+ The Assembly.
and the class should be declared properly in the control markup.
|
|
|
|
|
I'm studying the book 'Developing Web Applications with Microsoft Visual Basic.Net' to prepare myself for the 70-305 exam. So, I am not familiar yet with this stuff. Where can I find the Register directive? I searched trough the menu's of this page (no, I am not familiar with this website either)
|
|
|
|
|
|
Ooh, you're talking about the Microsoft-page. Sorry, I was looking at codeproject.
Yes, I heard about the new generation, and there is a good chance that I'll pick it up right after this exam. Just a few chapters, then do the exam, then I am in the possession of the MCAD certificate. ( I already did the 70-306 and 70-310 exam). Anyway, this study-program is set up by my company.
The new exams are 70-328 and 70-536 right? For the MCTS.
|
|
|
|
|
RCO-Man wrote: Ooh, you're talking about the Microsoft-page. Sorry, I was looking at codeproject.
But if there are any specific issues holding you back, you can come here to seek for help .
RCO-Man wrote: Anyway, this study-program is set up by my company.
Ah, Okay I see, you are in the progress.
RCO-Man wrote: The new exams are 70-328 and 70-536 right? For the MCTS.
Correct, and with 70-547 to become an MCPD (Web Developer), but once you have obtained the MCAD, you will only have to take the 70-551 exam to upgrade your status.
|
|
|
|
|
Your class name is SortTextBox , but the custom control markup is SortedTextBox .
|
|
|
|
|
Yeah, I found it while I was explaining the problem, but thanks for your help!
|
|
|
|
|
SqlConnection conn = new SqlConnection();
SqlCommand comm = new SqlCommand();
try
{
conn.ConnectionString = "data source = (local); initial catalog = MiratechDB; integrated security = true;";
conn.Open();
comm.Connection = conn;
could some1 pls explain to me how these codes work
and also how i can change it to have user login in the connection string pls
|
|
|
|
|
This is opening a database located on the local machine. The name of the database is MiratechDB.
It's in a try statement in case of failure. Usually it's a try/catch or something like that and if it fails you spit out an error message.
|
|
|
|
|
ic..
now i got a web host and i am trying to host the file so do i have to change any of these?
like to include user login in the connection string?
also could any one giv me any tips or website i can view to gain knowledge of how to host asp.net files
having a lot of trouble just Hosting the file......... plsss
|
|
|
|
|
Hi,
U should change the following in the Connction string:
server name, database name, user id and password should be changed to that of the server in which u r going to host.
I dont know abt any sites.. But I can tell u simple procedure..
You have to upload your project files and the database backup to the server by using FTP or Remote Desktop COnnection available in Windows...
In the Server machine,
Then u have to go to IIS in Control panel->Administrative Tools
In IIS, right click Deault Web Site and create an new virtual directory. Browse and specify the location of ur copied files..
Then regarding database, restore the backup database to the server.
Then u have successully hosted ur web project...
Regards,
sdaniel_cst
|
|
|
|
|
firstly do you think you could giv me the sysntex of the connection string which include the server name, database name, user id and password pls.
as i dont have any.
also about your procedures, i already put all my asp files into a sub folder in my webpage using ftp. however i would like to ask if i need to compile them or anything? coz i simply put ALL the files into that subfolder >.<
and lasty wat u mention in the server machine.
do u mean i have to go to the control panel that the web host gives me and set up the lls? as i recall doing this on my computer before but i am trying to host them on a real web page now.
|
|
|
|
|
Hi,
An example of connection string
dim con as new Sqlconnection
dim str as string
str="server=MACHINENAME;database=DATABASENAME;uid=sa;pwd=sa;"
con.connectionstring=str
con.open()
You have to just copy ur files to the web server by ftp and then create a new virtual directory in IIS as I mentioned earlier.Thats all. Then u type the url
and check whether it is working..No need of any compiling.
Server means the machine in which u will be hosting the site, which u will be logging by remote desktop connection
Regards,
sdaniel_cst
|
|
|
|