What are you using? Webforms, WPF, Winforms, MVC?
What are you using? Webforms, WPF, Winforms, MVC?
Perhaps this code will help you, found at SharePoint Code Snippets by Sudarsan
Example- Get Full Url Of A SharePoint List
SPUtility.GetFullUrl(SPContext.Current.Site, listobj.DefaultDisplayFormUrl);
Example- Get Full Url Of A SharePoint ListItem
SPUtility.GetFullUrl(SPContext.Current.Site,"/"+ itemobj.Url);
What have you tried so far?
Hey folks. Great job on the new site!
Reporting a strange overlay issue on the Homepage in Chrome 19.0.1084.46 m on 64bit Windows 7.
There is a taller than normal header and a blank spot on the right sidebar that, on mouseover, displays an overlay on the screen. Like the login box overlay but without the login box... If that makes sense.
Clear cache, etc etc of course.
EDIT:
Just realized it was my Adblock extension. The "spots" were blank because of adblock, but the overlay still showed on mouseover. Not sure if you can put placeholder images where the ads go to make it a little more clear as to what is happening?
Any way, keep up the good work!
Ok, still not 100% sure what you are trying to accomplish, but I do know that the biggest issue is the way you are looping with the data reader.
I've taken your original code and converted to a datatable and it outputs the following in the richtextbox1: Section: 32 Measurdate 7/20/2010 12:00:00 AM
Here is the modified code with a datatable you can actually use to loop with:
int[] fj1Sections = {1,35,33,32,20,19,17,16,18};
bool test = true;
string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=car_mos.accdb;Persist Security Info=False";
string queryString =
"SELECT dbo_SectionMeasure.[BakingFurnaceNo], dbo_SectionMeasure.[SectionNo], dbo_SectionMeasure.[MeasureDate], dbo_SectionMeasure.[IsLastValue] FROM dbo_SectionMeasure ORDER BY dbo_SectionMeasure.[MeasureDate] DESC;";
OleDbConnection connection = new OleDbConnection(connectionString);
connection.Open();
OleDbCommand command = new OleDbCommand(queryString, connection);
DataTable dt = new DataTable();
dt.Load(command.ExecuteReader());
try
{
OleDbDataReader reader = command.ExecuteReader();
for (int i = 0; i < fj1Sections.Count() ; i++)
{
for(int x=0;x<dt.Rows.Count;x++)
{
string section_no = dt.Rows[x][1].ToString();
if ((section_no == fj1Sections[i].ToString()))
{
//result;
richTextBox1.Text = "Section: " + fj1Sections[i].ToString() + " Measurdate " + dt.Rows[x][2].ToString();
}
}
}
}
catch (Exception ee)
{
richTextBox1.Text = ee.ToString();
}
I'm sure there is a more efficient way to do this, but hopefully this gets you going!
OK, so let me get this straight:
If you have the following:
1 35 1/1/2009 true
1 35 1/1/2011 true
1 16 1/1/2009 true
1 16 1/1/2011 true
You want to get rows 1 and 3 correct? The oldest date for 35 and oldest date for 16, right?
Ok, I understand a bit more now after running your code.
You are looping over each of the number in your list AND looping through your records.
It's not working because the while(reader.read()) does not reset each loop. The .read() function is forward only. See this MSDN article on the class.
I hope this helps. Try populating a dataset, then you can using it multiple times.
Why the for loop? The while loop goes through all the rows.
Not sure if I understand you right. Can you give me a few examples database rows and what outcome you want?
Given database rows:
ID Num Date
1 34 1/16/2011
2 34 2/5/2011
3 13 5/5/2011
I'm assuming that when you Choose "34" in your dropdown, you want to get the oldest date, in this case, 1/16/2011.
Is that right? If so, my previous query does the trick. If not, we need to further refine.
Why don't you use a SQL Statement instead? If you only need one record (oldest date) then it isn't efficient to bring back all records from the database.
Amend your query to something,
SELECT TOP 1 [fieldname], [etc...], FROM tablename WHERE [column2] = '<listvalue>' ORDER BY [datefield]
That will give you one row with the oldest date where the column2 is equal to the value in your ComboBox.
Note: Highly recommended to use a parameterized query and not just concatenate the string, but this is just the sql example.
This reduces network traffic and greatly enhances your response time.
How can i use the data grid for in putting data in the database when you are using visual basic 6.0? Please help
Robbin, this thread is 5 years old. Please start a new thread.
PS: try giving more information too, like what you have already tried, what type of database, etc.
Cheers,
Hmm, off the top of my head, name is depreciated. What browser are you trying? Swap out "name" for "id".
Also, try
onclick="return clearVillage();"
Some browsers, (IE usually), likes the return keyword at times.
Also,
Check to ensure the button isn't calling the function before the function is declared. (i.e. is the function declared in the <head> tag?)
High quality like that is rarely free. Just sayin.
I would add Unity to the list of choices. I recently created my first basic game in Unity. It took me about 4 evenings to get it to beta status.
The biggest plus to unity is its multi-platform. 2nd is that you can do a lot of stuff by drag and drop. 3rd, it has a built in physics engine which REALLY helps when you are just learning.
My advice is do something very basic (like pong) in Unity or another game creator tool first. Then move on to C#, C++, Java, etc. Otherwise, as already said, you will find yourself quickly overwhelmed trying to do the most simple task.
Cheers.
Try setting a css class to that column and setting the css style "visibility:hidden;". This way asp can still access the data but the user won't see it.
If the data is confidential then your best bet is to pull the data from DB on post back and work with it there.
It will run on a vps type, you don't need dedicated, vps is ok, unfortunatly, not normal shared hosting.
Ah, thanks for that. I just found out he ordered shared hosting today so I'll try to run a solution on that. Might convince him to upgrade though, depending on expected volumes.
Why not just download shoutcast server and install on your friends server? That way you have the back bone to produce online radio, by using winamp to stream content to the shoutcast server, and listeners can tune in.
Will shoutcast run on a shared hosting environment? I was under the impression you needed a dedicated server to install it.
A friend of my recently asked me to help him set up a web based radio. Upon doing some research I found he has only original content (not copy right stuff), all static mp3 files, not live talk, and wants to loop the audio.
I've found sites like radionomy and some free shoutcast hosting sites but they all either inject ads into the audio or make you use a page covered in ads.
I got to thinking: In .NET/asp I can set the headers/mime type of my page as say pdf/excel file/zip file etc and the browser offers it as a download.
In PHP (his server only supports php) is it possible to set a file mime type as some sort of streaming file m3u or something? It would of course need to keep serving mp3s so when one finished another one would start.
Curious if anyone has some input on the subject matter!
Thanks.
Thanks for your help! I'm finding this example very useful and will attempt to apply it to my project.
I just want to make sure I have a proper understanding of the code;
The top half is declaring the class and variables. get and set are bassically assigning null values. The first line of the second block of code declares a list class. the " ... " represent where the loop mechanism would be. new ImageFile creates a new object and the remaining lines; (after the equal signs) assign the properties.
This simple project puts the pieces together for you. I commented pretty much every line to explain how things work.
Is it possible to have these objects created dynamically?
Speaking in code "For each Jpeg in the directory > create an object > assign the object a unique name (imageFile + i++) > assign the file name/location > assign some more data"
Use this to iterate through files in a directory.
string MyDirectory = "C:\\";
string MyString = "My Files: ";
try{
string [] MyFiles = Directory.GetFiles( MyDirectory, "*.jpg", SearchOption.TopDirectoryOnly );
foreach( string MyFile in MyFiles )
{
MyString = MyString + MyFile + "; ";
}
MessageBox.Show( MyString );
}
catch(Exception MyError){
MessageBox.Show("Error reading file: "+ MyError.Message);
}
from: http://www.ehow.com/how_5160227_loop-getfiles-microsoft-visual-sharp.html#ixzz13ZiSh7Vz
The BindingNavigator doesn't seem to have a seek, find or search method. But, you can easily create a loop to find the record.
Without seeing code it's hard to give you examples, but something like:
Have your button pass a unique id identifying the record to a method.
The method starts at MoveFirstItem and checks the id for a match, using MoveNextItem until a match is found.
Ah sorry, I was thinking ASP.NET.
There is a DataGridView in WinForms though. Under the Data Controls section in the toolbar.
Here try this: (sample VS 2010 project attached.)
webBrowser1.Navigate(textBox1.Text);
if(webBrowser1.EncryptionLevel != WebBrowserEncryptionLevel.Insecure)
label1.BackColor = Color.Green;
else
label1.BackColor = Color.White;
EDIT:
You'll need to check for mixed authentication mode as well but this should get you on the right track.
What objects are you using for web browsing? The built in .NET browser? Try pasting in the code where you are trying to accomplish this.
Oh, your writing a browser. That wasn't clear to me, Sorry.
Use something like:
HttpRequest request = application.Request;
if (request.IsSecureConnection)
{
//do something
}
Exactly. If you want that to "Turn Green" you need an SSL certificate installed. You need to purchase one and have it installed your web server.
I think the grid view and detail view should do this for you. Check those controls out.
You can use an option group for multiple choice answers. A module or project level variable will hold the score.
Give it your best shot and post your code if you have issues.
Where is it hosted? You usually have to order a Certificate from a provider like RapidSSL, GoDaddy, Geotrust, etc.
The process will involve a bit of back and forth from your hosting provider unless you manager your own server.
Some shared hosting accounts provide a free shared SSL, but that changes your URL from yourdomain.com to yourdomain.hostingdomain.com.
$50(ish) per year gets you a cert at GoDaddy.
Should this data be stored in an array? or an sql database?
What you have there is meta data. The best way to get started from your level is to think about that data as an object.
So, each picture will be an object with properties. Size, location on disk, photographer, caption etc will all be properties of this picture object.
1) Create a class for your picture object and properties for each of the meta data you want to store.
Now that you have your objects in place, you can think about persisting them. You can serialize them to the hard disk using the Serialization classes in .NET or save them to a database. Which you choose depends on how much data, who else (or what programs) may also need access to your data, etc.
I hope that helps you start thinking on the right track.
This should get you on your way. http://www.codeproject.com/KB/GDI-plus/TransparentImageWatermark.aspx
If your going to store the rules in SQL Server, why not store the data in SQL server?
If you really can't move the data, you can use an XML file to store the validation rules and then compare the data in the text file.
So your XML file would specify that column 1 is a DateTime.
Open the data file and do a TryParse to a DateTime. Most if not all the data types expose a TryParse method which use an output parameter and return boolean results.
Using a Repository type pattern you can abstract that away and make the code more usable too.
The basic idea is this:
Each port can only have 1 passive listening socket, but many active sockets.
You code must listen for connections on the port, when one is detected, it must create a new socket to handle the active connection and then go back to passively listening for another connection.
Google will give a lot of code examples of this.
=pls help me about my inventory liabrary system
Please don't resurrect old threads. Start a new thread _after_ you search and be MUCH more specific about your issues.
That will help people respond more quickly to your question.
Cheers.
@ibennz Please don't respond to 4 year old threads. Kindly appreciated.
I did something similar recently. Basically a form which requires approval before being saved.
So, I created a copy of the table which normally holds the form data.
On save, the data is saved to the copied table. Once approved, the data gets copied to the original table and the record deleted from the temp table. If course, it usually just as easy to create an extra field on the table called Published or Draft and use it as a flag to determine whether or not the validations should be carried out.
In my case that would work as I was dealing with edits to live data and still needed another place to store the draft edits before being approved and made available to the public.
If your just starting you could probably save some work and just use a flag to determine between "draft" and "saved".
You should ask this question over in the .net forum....
I feel your pain. We have several applications written in classic asp. We are starting all new projects in VS2008, .NET platform.
All of our legacy asp code is maintained via Dreamweaver CS3 or CS4.
While I know a complete port to .net is usually not cost effective, I would recommend taking the leap to .net for new stuff. And you can run VS 2005 alongside VS 2008, so perhaps that would help with the debugging.
With ASP, you want to use the QueryString Collection of the Request Object.
http://www.w3schools.com/ASP/coll_querystring.asp
So, you would code something like this:
Dim email
email = Request.QueryString("email")
I would also suggest creating a hash (md5 or sha) from the email and using that in the querystrings. This just keeps your querystrings a bit more secure and anonymous.
Hope that helps!
CSS styled XHTML is much better for a blog. gridviews would probably just create too much extra html and probably even table tags.... :S
Back to your question, it is not good practice to have 2 submit buttons for 1 form_object; rather use regular buttons with a JS document.location or a drop down box for your selections that have their own unique value.
If this is a public site, forms and javascript are not a really good idea in terms of accessibility. Industry best practice is actually to have all forms working _without_ javascript, and then you can use javascript to override that functionality. This way, the website works with both javascript on and off, which is good for the visually impaired using screen readers, mobile phones (I've seen several blackberrys with JS turned off by default...) etc.
TomBCullen is correct in stating that two submit buttons shouldn't be used. If you wish to have one button as a default, then set that as a type="submit" other wise set both to just type="button".
Have you tried ".AddItem" with column values separated by "vbTab"?
Yomet
I dunno, that was 2 years ago :P !!
The problem is you're not closing the connection. You're returning a data reader which requires an open connection to read the data. You need to declare a DataTable and use dt.Fill(rs);
That is C# and using the base class, but port the concept over of using the datareader and returning a datatable.
I hope this helps
This helps a lot actually. Too much classic asp on the go.
The c# code is awesome. I was trying to avoid using too many system resources by using a DataReader, but looks like that backfired.
Off to fix some code then. Thanks again.
Some strange errors occurring in my asp.net website.
I was using the MS ApplicationBlocks.data.dll to connect o my SQL database. Once I started testing my website on IIS as opposed to the ASP.NET development server, I started getting connection pool errors.
So, like anyone would, I searched for every instance of opening a recordset and ensured that each one was closed right after being done with it.
Still no luck.
So, I wrote my own data wrapper function, very basic, which returns a DataReader and explicitly closes the connection each time.
Then, I started getting an "ExecuteReader requires an open and available Connection. The connection's current state is closed.." error. I've modfied my function as below, which catches the error, clears the Connection Pools an re-opens the connection. This function hasn't caused any problems in my testing, except that every 9-11 clicks I notice a much longer page load as the exception is caught and handled.
I really don't want to leave this code as is. Can anyone shed some light onto the possible root cause?
Thanks!!!
Private Function _getRS(ByVal strSql As String) As System.Data.SqlClient.SqlDataReader
Dim conn As New System.Data.SqlClient.SqlConnection(strSQLconn)
Dim cmd As New System.Data.SqlClient.SqlCommand(strSql, conn)
Dim rs As System.Data.SqlClient.SqlDataReader
Try
conn.Open()
rs = cmd.ExecuteReader
Catch ex As Exception
System.Data.SqlClient.SqlConnection.ClearPool(conn)
System.Data.SqlClient.SqlConnection.ClearAllPools()
System.GC.Collect()
conn.Open()
rs = cmd.ExecuteReader
Finally
End Try
Return rs
cmd.Dispose()
cmd = Nothing
conn.Close()
conn.Dispose()
conn = Nothing
End Function
This is c# code, not classic asp, you should ask this in the ASP.NET forum.
Sounds like a web application to me. I would recommend heading over to w3schools..... best place to start learning classic asp IMHO.
Look up the ADO, ASP and VBSCRIPT categories and post back here if you have specific questions.
Generally, you will need to:
1: use a form to get search criteria from user
2: validate the input to check for sql injection and bad input
3: query the database and retrieve data using a recordset
4: display the returned data via a form with proper inputs or use a datagrid control
5: provide a save button which submits the data back to a processing script which again validates the date and uses a "UPDATE" sql command to save the data.
Try doing a response.write(Request.Form("buttons"))
on your decision.asp page and let me know what the value is when you click on either button.
Ok, the answer lies in your use of request.form, which is incorrect.
You are requesting the value of your form. You must request the value of a form item, not the form itself.
So you have <form name="Form1" method="POST" action="decision.asp">
and Request.Form("Form1")
So you can see that your requesting the value of the form. Instead, you should be requesting the value of your buttons inputs, like so: Request.Form("Buttons")
So, make that change in your decision.asp script and it will work. I have successfully ran it here and landed on buttonA.asp and buttonB.asp.
I would also recommend dropping the FONT tag and using valid xHTML 1.0 Transitional or Strict.
Cheers, please mark as solved once you get your code working!