|
Currency is not a member of System.TypeCode
|
|
|
|
|
williammcq wrote:
VPODS.InsertCommandType = SqlDataSourceCommandType.Text
Why "SqlDataSourceCommandType"? Your database is MS Access??
williammcq wrote: I have setup a insert command that includes a dollar value like so:
VPODS.InsertCommandType = SqlDataSourceCommandType.Text
VPODS.InsertCommand = "INSERT INTO [VPO] ([OrderDate], [Project], [Supplies], [NoExceed])VALUES (@OrderDate, @Project, @Supplies, @NoExceed)"
VPODS.InsertParameters.Add("OrderDate", Now())
VPODS.InsertParameters.Add("Project", Project)
VPODS.InsertParameters.Add("Supplies", TypeCode.Boolean, Supplies)
VPODS.InsertParameters.Add("NoExceed", TypeCode.Decimal, NoExceed)
rowsAffected = VPODS.Insert()
It is posting to an Access DB and the NoExceed file is of DataType Dollar.
Why don't you use OleDb ff your database is MS Access?
OleDbType.Currency
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
I set up a string in the web.config file so I could use SQL because I would like to convert the client over to SQL in the future and don't want to rewrite every darn connection in the app. Make since?
|
|
|
|
|
I tried OleDbType.Currency() in place of TypeCode.Decimal and VWDE tells me its not declared.
I love your suggestions, I just wish I could get one of them to work. I appreciate your time.
Doe the fact that this is a Access DB and not a SQL DB causing a problem?
|
|
|
|
|
Maybe. you can try like that..
using System.Data.OleDb;
OleDbConnection dbConn = new OleDbConnection ("connectionstring");<br />
dbConn.Open ();<br />
OleDbCommand cmd = new OleDbCommand ();<br />
cmd.Connection = dbConn;<br />
cmd.CommandText = "INSERT INTO [VPO] ([OrderDate], [Project], [Supplies], [NoExceed])VALUES (@OrderDate, @Project, @Supplies, @NoExceed)";<br />
<br />
cmd.Parameters.Add("OrderDate", OleDbType.Date, Now());<br />
cmd.Parameters.Add("Project", Project);<br />
cmd.Parameters.Add ("Supplies", OleDbType.Boolean, Supplies);<br />
cmd.Parameters.Add("NoExceed", OleDbType.Currency , NoExceed); <br />
<br />
cmd.ExecuteNonQuery ();<br />
<br />
cmd.Dispose ();<br />
dbConn.Close ();
williammcq wrote:
Doe the fact that this is a Access DB and not a SQL DB causing a problem?
maybe. or may not be... AFAIK, we should use OleDb for MS Access Database and SqlClient for SQL Database. I didn't see any documentation mentioned that SqlClient should be used for Microsoft Access Database.
Hope it helps..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Here's the link that answers your comment on documentation for using SqlClient for a Microsoft Access Database.
http://msdn2.microsoft.com/en-us/library/hktw939c.aspx
|
|
|
|
|
I am trying to migrate my web application to Ajax, but i am encountering some problem
The first thing I would like to do is to make my menu bars collspable in an ajax style. Sort of like the XP windows explorer. The problem is that the main content of the page was not implemented with AJAX and as a results, many buttons will cost a post back and refreshes the page. As soon as the page is reset, the collipsable menu resets itself to initial state, not saving what was expended before.
I solved this problem using session, at the load of the collapsable control, it will read the session and determine what is being closed and not.
I am wondering if there are any change personalization can help me in this. and if not, what other way can be done
Thank you
|
|
|
|
|
I am assuming that by AJAX, you mean the Microsoft AJAX library, not AJAX itself. Otherwise, you'd be writing menus and so on. The fact is, the point of AJAX is that it doesn't do postbacks, so if you want to 'AJAX' a page, you need to change those buttons to make AJAX calls instead of posting back.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yes, i know that Ajax doesnt do post backs, however, not all buttons in my application are Ajax enabled. As of now, i am only trying to migrate the menu to Ajax, so, clicking on any button not on the menu will do a post back
|
|
|
|
|
Please help me, I share some multimedia files over IIS website in local area. but every type of files are working except .DAT & .VOB extention. I put MP3, WMV, MPG, DAT, VOB files but upon clicking on link the browser shows that site not found but when clicking on MP3 or other files then the link works. I will be grateful if someone help me.
Julian
|
|
|
|
|
You have to register the mime type with IIS. To do this go to Admistrative Tools -> IIS Manager click on the computer and select Mime Types. Add the mimetypes for .DAT and .VOB.
Refer to the screenshot below:
MimeTypes.gif (37.9 Kb)
|
|
|
|
|
Thank you sir for your kind support. one more favour if you prefer that when i click on the link that was hyperlink in asp page browser goes to download rather than initiating media player and give control to media player. can i do this. i will be grateful.
Julian
|
|
|
|
|
hi there !
I'm new in asp.net , I want to add menu in the page like the menu of WinApplication .
thanx for any help !
s_mostafa_h
|
|
|
|
|
I'm really hating web development, since the last 2 weeks have been nothing but hell.
I have VS.Net 2005 on my PC (with the included SqlServer2005 dev tool).
I created 2 users for login control testing in the project (APP_DATA).
It appears that I can't get lost-password email to send because my pc isn't on the whitelist.
Our development web server is on the whitelist, but only has SQL Server 2000.
When I publish my project to the server, I get errors that SQLServer 2005 is not configured for remote access. Does this mean the project is trying to access my PC for the login stuff even though it resides in the project APP_DATA folder?
Will the database even handle the .MDF file, since it was created in a newer version?
How do I redirect this?
"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
"There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain..."
|
|
|
|
|
im currently doing a web application using C# & asp.net I need to access database in every webpage,can any of you refer me to examples or samples web applications or anything that can help
thanks
regards paula
|
|
|
|
|
No, we can't! This is because according to the n-tier architecture you website shouln't be able to gain access the database. Therefore you will need to create a business 'layer' or business project which will return your data.
In the business layer you gain access to your database and return an object to your website...
Example :
<br />
public class Clients : IDisposable<br />
{<br />
<br />
private SqlConnection _Connection = null;<br />
<br />
public Clients()<br />
{<br />
_Connection = new SqlConnection("ConnectionString")
}<br />
<br />
public DataTable GetAllClients()<br />
{<br />
}<br />
<br />
public DataRow GetClient(int ClientID)<br />
{<br />
}<br />
<br />
public int CreateClient(string Name)<br />
{<br />
}<br />
<br />
public bool UpdateClient(int ClientID, string Newname)<br />
{<br />
}<br />
<br />
public bool RemoveClient(int ClientId)<br />
{<br />
}<br />
<br />
public void Dispose()<br />
{<br />
if (_Connection != null)<br />
_Connection.Dispose();<br />
_Connection = null;<br />
}<br />
}<br />
<br />
This would make your web-app very neat, and you don't have to worry about the database connection anymore :->
|
|
|
|
|
I have a VB variable in an aspx page and want to pass its value to a javascript function within the same page. Any idea how to do this? The variables are read from a database thus:
Dim Lat As Double = CDbl(r("PlaceLat"))
Dim Lng As Double = CDbl(r("PlaceLng"))
and I would like them to be recognised by a google maps javascript line thus:
.
.
var point = new GLatLng(Lat,Lng);
.
.
<\script>
|
|
|
|
|
I did it this way after reading variables from database. Do not know if there is another better way.
Dim jsScript As String
jsScript = "jsVar = '" & VBVar & "';"
Dim cs As ClientScriptManager = Page.ClientScript
If (Not cs.IsStartupScriptRegistered("InitJSVar")) Then
cs.RegisterStartupScript(Page.GetType(), "InitJSVar", jsScript, True)
End If
|
|
|
|
|
Thanks for this. By doing this code, am I making jsVar available to any javascript on the page so that I can have:
var point = new GLatLng(jsVar,jsVar2);
or do I need to put all the code in the jsScript :
jsScript="" & vbCrLF
jsScript=jsScript & "jsVar = '" & Lat & "';"
jsScript=jsScript & "jsVar2 = '" & Lng & "';"
jsScript=jsScript & "var point = new GLatLng(jsVar,jsVar2);"
jsScript=jsScript & "<\script>"
Will the javascript then run where this is placed:
Dim cs As ClientScriptManager = Page.ClientScript
If (Not cs.IsStartupScriptRegistered("InitJSVar")) Then cs.RegisterStartupScript(Page.GetType(), "InitJSVar", jsScript, True)
End If
|
|
|
|
|
Yes, this way jsVar will be availeble on the page, and can be accessed in javascript. Since, this variable is declared on page so, its scope will be page.
In case you have two javascript variables that you want to initialized based on you database value, you will have to follow second approach.
By doing this you are generating javascript code on the server side that will be available on the page once loaded.
HTH
|
|
|
|
|
This worked perfectly. As I was writing away a marker for each database record read, I had to make the key (InitJSVar) a string so that I could change the key each time a new record was read ie first record = InitJSVar1, second record= InitJSVar2 ...etc
Many thanks
Will give you 5 rating
|
|
|
|
|
As I said here ~
you can use server-side hidden field to communicate between client-side and server-side.
<input id="Hidden1" type="hidden" runat="server"/>
In Form_load
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
Hidden1.Value = "13";<br />
}
You can set like that..
In Client-side ~
<script language="javascript" type="text/javascript"><br />
function getvalue(){<br />
var var1 = document.getElementById('Hidden1').value;<br />
}<br />
</script><br />
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Thanks for assisting me - I ened up using peacefulmember's solution
|
|
|
|
|
Another Easy option might be to use inline tags. Some people like it some hate it. If you feel that it is cleaner than the other options you can do something like this.
<script type="text/javascript>
.
.
var point = new GLatLng(<%= Lat%>,<%= Lng%>) ;
.
.
</script>
Co-Author ASP.NET AJAX in Action
|
|
|
|
|
Thanks for your help - I ended up using peacefulmember's solution
|
|
|
|