|
Hi
I am tryin to build a web front end which will speak to a mysql database in the background
I have decided to help with performance and maintainibility i am going to try and use stored procedures to extract data from database so i don't need to put all the sql through the script.
I am not sure if i am going in the right direction with this as i am a newbie at this game. I have produced the following function which i believe is correct.
Private Function spTest() As DataSet
Dim connectionString As String
'create connection to databases passes strings into mySql login
connectionString = _
"server=localhost; uid=*****; pwd=*******; " + _
"database=test"
'Sql command string, can enter stored procedure call here
Dim connection As New MySql.Data.MySqlClient.MySqlConnection(connectionString)
connection.Open()
Dim command As New MySql.Data.MySqlClient.MySqlCommand
command.Connection = connection
command.CommandText = "test"
command.CommandType = CommandType.StoredProcedure
Dim daAdaptor As New MySqlDataAdapter
daAdaptor.SelectCommand = command
daAdaptor.TableMappings.Add("id", "firstname")
Dim dataset As New DataSet
Dim table As DataTable = New DataTable
daAdaptor.Fill(dataset)
Return dataset
End Function
my stored procedure is just a simple select statement which extracts the id and name fields in my database
i want to be able to display my results in a datatable in the web browser.
has anyone get any hints in where i should go from here?
I am guessin i now need to build the page_load method and get it to call this function and pass the dataset variable into a table display method?
any help appreciated
boyindie
|
|
|
|
|
You're on the right track, keep going.
only two letters away from being an asset
|
|
|
|
|
|
ass [et]
only two letters away from being an asset
|
|
|
|
|
if thats an attempt at a joke its reallty quite pathetic
|
|
|
|
|
I'm trying to assign a data value in a gridview template during the databind operation. I've replaced the Bind("column_name") with a custom function. In that function, I want to take one of the values from the datatable's rowset (a vendor number) and lookup the name for that vendor returning that as a string. The following code is what I am trying to accomplish.
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# GetVendName() %</asp:Label>
</ItemTemplate>
I want GetVendName() to obtain the vendor number from the datatable and do a lookup returning the name of the associated vendor.
How can I reference the current VendorNumber column from the datatable object of the GridView during the "DataBind()" process in GetVendName()??
Thanks
|
|
|
|
|
First of all.... you're going to want to close your tag there... it should say <ASP:Label ID="Label4" runat="server" Text='<%# GetVendName() %>'></asp:Label>
And.... why not just select the vendor name to begin with? Why go through the extra step of converting a vendor number?
|
|
|
|
|
The closing tag is probably just an error when copying and editing the code in my post. The vendor name is coming from a different database so I can't include the name in the select statement.
Excellent question though!
|
|
|
|
|
Hampden Tech wrote: The vendor name is coming from a different database so I can't include the name in the select statement.
If you have a data access layer that provides the resultsets appropriate for the presentation layer you won't have this problem.
only two letters away from being an asset
|
|
|
|
|
I'm creating a web app using ASP.NET and AJAX. It was working fine till last week. Without anything obviously changed, it began loosing HttpContext between the "PageLoad" and Page Events of a dynamically added User Control. The main ASPX page has a placeholder to load the dynamic control. To avoid "View State Tree" errors, I add the pre PostBack User Control back into the placeholder in the "OnInit" event of the ASPX page, then remove it and add the new User Control in the "PageLoad" event. The code goes to the "PageLoad" event of the newly added User Control (uc1) (all is fine here), then it goes to the "PageLoad" of a User Control inside this first user control (uc2) (all is still fine here). Then the code goes back to whatever Event that was fired on uc1 (it is here where HttpContext is lost). Mind you that this setup was working fine since it's inception about one month ago. I have been tinkering with it all along and have not made any app-wide changes (to my recollection) that could create this effect. Anybody ever come accross this problem.
any help will be greatly appreciated.
Fausto
|
|
|
|
|
Hi,
I have a button field in GridView. It shows the ID. When I click on it should grab the id and open new ASpx page based on that ID.
How can I do that.
Thanks in advance
seema
|
|
|
|
|
You got to assign a property called command name!
So assign a command name to your button and write your logic accrdingly in the ItemCommand event!
if(e.commandname=="name")
.....
....
.....
Gautham
|
|
|
|
|
while click the button you have to fire an event (you can call edit,delete ... command). In that function you can get the selected rows and you can process what ever you want.
Thanks
Warm Regards
Prakash-B
|
|
|
|
|
In my web page, I have a TreeView control. It databinds the image property on every node, however, the images I have are all different sizes, and I need them all to display 64x64 on the page.
Is there anything I can do short of manually resizing them with photoshop? I'd do that... but I don't have the time.
|
|
|
|
|
Hello Friends,
I am in a search of some information over asp.net. I have created a web application which my client requires to set in on a server which is phisically present in the company premises itself. The condition of the client is such that when the users are using the application in the same premise they should not be routed through internet, so the bandwith could be saved. Over there they should use LAN for processing the application. But for the user who is accessing the website through internet should hit the same server and application. So in short they need that the application should have two pointers.
I have tried giving it two pointers, the application is getting accessed through internet, user can login sucessfully but as the any activity is clicked it displays "Page Cannot be displayed" the reason is it is searching for internal server files through URL.
Eg...
My test application is deployed by name http://testsoft/login.aspx
My live application which has a public ip is by name http://255.26.235.22/login.aspx
When user logs in a web application internaly and clicks on any activity through LAN the application redirects the pages through the url http://testsoft/myactivity.aspx
But when user logs in a web application externally it should display ip http://255.26.235.22/myactivity.aspx but instead of that its getting redirected to http://testsoft/myactivity.aspx which is basically for internal users. So external users are not getting access through the activities of the application and the result which gets displayed is "Page cannot be displayed".
Is there any solution related to global.asax file ? If any kindly let me know.
Please reply ASAP,
Nikhil Bandekar
Mumbai,
India
|
|
|
|
|
Hey Nithil,
Nikhil Bandekar wrote: My test application is deployed by name http://testsoft/login.aspx
My live application which has a public ip is by name http://255.26.235.22/login.aspx
The above code shows that you are using Absolute Path instead of relative path. Eg, You must use Response.Redirect("Login.aspx") where Login.aspx file is located in the same root not Response.Redirect("http://testsoft/login.aspx").
Nikhil Bandekar wrote: Is there any solution related to global.asax file ? If any kindly let me know.
As per knowledge nope... But I have seen some application are frame the URL in Global.asa or Global.asax file. You check both scenario.
|
|
|
|
|
hii...i m trying to open a file in asp.net(C#)..
here how my code looks like..
string maulik =Server.MapPath("maulik.txt");
StreamReader sr = File.OpenText("C:\\maulik.txt");
string contents = sr.ReadToEnd();
Label2.Text=contents;
sr.Close();
this works fine...but have to provide a filename...
how can i open a random file using a dialog box and then read it...
help required urgently
|
|
|
|
|
What exactly is it that you need help with? Opening the dialog box? Getting the file name from the dialog box? Using the file name in the code that reads the file?
---
single minded; short sighted; long gone;
|
|
|
|
|
i dont want to specify a file name but open a file to read while browsing 4 it...n opening it
|
|
|
|
|
What exactly is it that you need help with? Opening the dialog box? Getting the file name from the dialog box? Using the file name in the code that reads the file?
---
single minded; short sighted; long gone;
|
|
|
|
|
need to open a file using a dialog box...
|
|
|
|
|
ahsan2011 wrote: need to open a file using a dialog box...
ASP.NET is serverside. However, you have HtmlInputFile to lend you little help.
|
|
|
|
|
Dears,
There is a website where u can post articles too..
www.exposecode.com
Mussarat Aziz
|
|
|
|
|
Your post as been reported as spam and will be treated as such.
|
|
|
|
|
I have a concern on your reply to the spammer. When I visited his profile, he has signed only for posting spam messages. So I think we can just report spam/abuse and ignore.
When you reply to his message, an email would go to him with your email address also. He might be successful in that way harvesting email addresses for his spam database for further improving his spam venture.
|
|
|
|