|
Double checked the regional settings, they are both the same...I think the problem was I did not properly detach the database from host pc and then try to restore from backup on the new pc. I just copied the file and used the add existing item option under visual studios app_data folder.
However, the database works fine with updates, inserts, general select queries...It is just the dates that cause the issue when their is new data that was inserted after I moved the DB file.
|
|
|
|
|
when i export arabic data to csv,some junk values are displayed instead of arabic text
this is my code
Private Sub WriteDelimitedData(ByVal Data As DataTable, ByVal fileName As String)
Dim i As Integer
Try
Dim context As HttpContext = HttpContext.Current
context.Response.Clear()
context.Response.ContentType = "text/csv"
context.Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", fileName))
context.Response.ContentEncoding = Encoding.UTF8
context.Response.Charset = "UTF-8"
'Write column header names
For i = 0 To Data.Columns.Count - 1
If (i > 0) Then
context.Response.Write(",")
End If
context.Response.Write(Data.Columns(i).ColumnName)
Next
context.Response.Write(Environment.NewLine)
'Write data
For Each row As DataRow In Data.Rows
For i = 0 To Data.Columns.Count - 1
If (i > 0) Then
context.Response.Write(",")
End If
context.Response.Write(row.Item(i).ToString())
Next
context.Response.Write(Environment.NewLine)
Next
context.Response.End()
Catch ex As Exception
End Try
End Sub
|
|
|
|
|
i have the same problem too
can any one help us plz
|
|
|
|
|
Hi,
I have put together some code based on an article I found on this site (http://www.codeproject.com/KB/sharepoint/SharePointFBAwDNN.aspx) on how to use DotNetNuke as the authorisation database provider.
While I can add users to the Policy for Web Application that come from the mebership provider, I cannot add any groups from the role provider.
Below is the code from the web application web.config.
*~*~*~*~*~*~*~*~*~*
<connectionStrings>
<add name="DnnSqlServer"
connectionString="Data Source=.\SQLExpress;Initial Catalog=DotNetNuke;User ID=dnnuser;Password=password"
providerName="System.Data.SqlClient" />
</connectionStrings>
.
.
.
<membership defaultProvider="DNNMembershipProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add name="DNNMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="DnnSqlServer"
enablePasswordRetrieval="true"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
minRequiredPasswordLength="4"
minRequiredNonalphanumericCharacters="0"
requiresUniqueEmail="false"
passwordFormat="Encrypted"
applicationName="DotNetNuke"
description="Stores and retrieves membership data from the local Microsoft SQL Server database" />
</providers>
<membership>
<roleManager enabled="true" defaultProvider="DNNRoleProvider">
<providers>
<clear/>
<add name="DNNRoleProvider"
connectionStringName="DnnSqlServer"
applicationName="DotNetNuke"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
</roleManager>
*~*~*~*~*~*~*~*~*~*
The web.config entries for the Application Management site are the same except the defaultprovider for RoleManager is AspNetWindowsTokenRoleProvider.
As I mentioned, adding users to the Policy for Web App seems to work so I know that the connection settings are correct.
Any ideas of why this won't work would be appreciated...
Thanks,
Baggy
PS... I switched off HTML for this post becuase it seemed to bugger up the code... even with the code block flags...
|
|
|
|
|
string branchid = "";
protected void Page_Load(object sender, EventArgs e)
{
branchid= Session["branchid"].ToString();
Response.ContentType = "image/jpeg";
Stream strm = ShowImage(branchid);
byte[] buffer = new byte[4096];
int byteSeq = strm.Read(buffer, 0, 4096);
while (byteSeq > 0)
{
Response.OutputStream.Write(buffer, 0, byteSeq);
byteSeq = strm.Read(buffer, 0, 4096);
}
Image1.imageurl=byteSeq;
}
public Stream ShowImage(string branchid)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Safa"].ConnectionString);
string sql = "SELECT imgleft1 FROM tblImages WHERE BranchId = @BranchId";
SqlCommand cmd = new SqlCommand(sql, con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@BranchId", branchid);
con.Open();
object img = cmd.ExecuteScalar();
try
{
return new MemoryStream((byte[])img);
}
catch
{
return null;
}
finally
{
con.Close();
}
}
hi iam using asp.net with c#
iam retreving image from database but i want to display in
image1.imageurl
but it is not displaying image
can you correct my code
modified on Sunday, May 16, 2010 8:59 AM
|
|
|
|
|
There is no url to display. You understand what a url is right?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Without digging too much into your code, i assume this is the problem:
The code you use - working or not - retrieves the actual image file from the
database, not the url. You try to write this image to response stream on
page load - working or not. This is totally ok, you have to do the following:
- Build a Page or Httphandler which writes the image to response stream
similar to what you did in your code-snippet
- In ANOTHER page, you set the imageurl of your image to this previously implemented "image-page" or handler.
This way, you get the desired effect. If i understood you correctly.
|
|
|
|
|
Hi,
I am trying to retrieve specific records from a table by specifying the parameter value at run time but the following error keeps occuring when i pass in a value of the correct data type.
System.Data.OleDb.OleDbException: No value given for one or more required parameters.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
at Service.RetrieveComments(Int32 ThreadID)
As you can tell from the error message I am using Microsoft Access database provider.
The data type for ThreadID is 'Number' and the field size is set to 'long integer'. The field does exist in the table. In my code I even tried changing datatype from 'int' to 'uint64' but that didnt solve the problem.
Here is the code I had developed.
<br />
[WebMethod]<br />
public DataSet RetrieveComments(int ThreadID)<br />
{<br />
<br />
String queryString = "SELECT * FROM [Comments] WHERE" + "([ThreadID]=@ThreadID)";<br />
DataSet dataSet = new DataSet();<br />
String connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/MyDatabase.mdb;Persist Security Info=True";<br />
OleDbConnection dbConn = new OleDbConnection(connString);<br />
OleDbDataAdapter dbAdapter = new OleDbDataAdapter(queryString, dbConn);<br />
dbConn.Open()<br />
dbAdapter.Fill(dataSet, "Comments");<br />
dbConn.Close();<br />
return dataSet;<br />
}<br />
Is there anything wrong with the above code?
I have tried the above SQL query in MS Access and it runs fine providing I remove the quotes and the "+" operator.
I would much appreciate if anybody could assist me please?
Thanks in advance.
|
|
|
|
|
The problem is because you are not setting the parameter value. Also, you need to use the ? and not a named parameter @ThreadID in the query.
public DataSet RetrieveComments(int threadID)
{
String connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/MyDatabase.mdb;Persist Security Info=True";
OleDbConnection dbConn = new OleDbConnection(connString);
String queryString = "SELECT * FROM [Comments] WHERE [ThreadID] = ?";
OleDbCommand oleDbCommand = new OleDbCommand(queryString, dbConn);
oleDbCommand.Parameters.Add("@threadID", OleDbType.Integer, 10).Value = threadID;
OleDbDataAdapter dbAdapter = new OleDbDataAdapter();
dbAdapter.SelectCommand = oleDbCommand;
dbConn.Open();
DataSet dataSet = new DataSet();
dbAdapter.Fill(dataSet, "Comments");
dbConn.Close();
return dataSet;
}
Make sure the parameters and syntax are okay. Also use the using statement to make sure your objects get disposed properly.
|
|
|
|
|
String queryString = "SELECT * FROM [Comments] WHERE [ThreadID]=" + ThreadID;
Can this work?
|
|
|
|
|
|
I have a master content web page application. I was told that I can set the style in the code behind by using the following:
if (Request.Browser.Version == "8.0")
Page.StyleSheetTheme = "Theme";
I have put this code in both the onLoad and the onInit in the content page and every time I run it I get the following error:
'The StyleSheetTheme property cannot be set, please override the property instead.'
Can anyone help.
Thanks,
Steve Holdorf
|
|
|
|
|
|
Hi Guys,
I want to implement following architecture and want to check with you if it generally makes sense, what you think about it and whether I could do it in a better way.
There is a gaming server which can provide information on the fly using a C++ plugin. I'd like to use this information, process it and display on web so people can look and see what's happening in the game without having the actual game. So I decided to open a TCP/IP connection between the gaming server and a web server (which will be sitting on a web hosting site, haven't decided which one yet). My worry is whether I'll be able to use the web server as a TCP/IP communication server, so the game plugin can connect to my web server listening for incomming connections on a background thread and receive the information.
Facts:
Gaming server running C++ game and a TCP/IP client sending data potentionally every second
Web Server (ASP.NET + Silverlight 4) running a TCP/IP server on a background thread listening for game server(s - will be potentionally more) and waiting for data.
I know it's a very trick question, but do you think that this architecture makes sense? Do you think I'll be able to connect to my webserver using TCP/IP from outside? Or would a different protocol by better? (sending data using http, but I'd like to avoid that as I think it would be slower and I would not be able to talk back to the gaming server if I needed).
Regards,
Stevo
zilo
|
|
|
|
|
You will have to first make sure that the hosting site you are using allows TCP/IP communications, most probably only allow HTTP outbound only.
My suggestion is (and not the only suggestion), if this is possible with the plugin you mentioned, have the plugin write to a database all the results you are wanting to see. Create a web service that will be used by the web page to query the database for the updated data. You can have the plugin update the database as much as you want and query the database as much as you want. So the performance will be there like any other web site.
If you can connect via TCP/IP to the host and from the game server, you could use Remoting and create an http/tcp channel to do this as well.
Hope this helps a little. There are more ways to do this, but only have time to post this suggestion.
|
|
|
|
|
|
hello
i am new to this and i am doing my assignment with vs2003. I need to create simple one page web project in vs2003 with one datagrid so I connect to northwind database in server ex. in vs 2003 and then drag a datagrid and then genereate dataset and configure dataset with database
but when i run the project it gives me error
Server Error in '/WebApplication3' Application.
--------------------------------------------------------------------------------
The SELECT permission was denied on the object 'Employees', database 'Northwind', schema 'dbo'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: The SELECT permission was denied on the object 'Employees', database 'Northwind', schema 'dbo'.
Source Error:
Line 192: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Line 193: 'Put user code to initialize the page here
Line 194: SqlDataAdapter1.Fill(DataSet11)
Line 195:
Line 196: End Sub
Source File: c:\inetpub\wwwroot\WebApplication3\WebForm1.aspx.vb Line: 194
Stack Trace:
[SqlException: The SELECT permission was denied on the object 'Employees', database 'Northwind', schema 'dbo'.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
WebApplication3.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\WebApplication3\WebForm1.aspx.vb:194
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2443; ASP.NET Version:1.1.4322.2443
waiting for your kind help
|
|
|
|
|
The error message says it all, the credentials you are using don't have SELECT access to the table. Use different credentials or add the rights to the user in Sql Server
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hello sir
thanks for your rep.
as you mentioned but i dont know how to do it so could you please tell me how to do it
waiting for your kind help
thanks
|
|
|
|
|
Don't know how to do what? Use a different connection string? Change permissions in SQL Server? If it's the former, then you need more help than just that. If the latter, then contact the SQL admin.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hello sir
yes it's done now thanks for your kind help
thanks again
|
|
|
|
|
Dear Freinds,
I have taken C1Toolbar on my master page, on click event of this toolbar, i try to generate excel from a grid on my content page.
There is one Filter button on Content page, for grid filtering.
When i click on Master page toolbar to generate excel report, and excel is re-directed on content page by "Response.Redirect("Excel");" statement.
After this process, whenever i click on Filter button on content page, master page toolbar event is called and the excel report is generated again. I dont know what is going wrong?
However, when i remove the "Response.Redirect("Excel");" statement the system works absolutely normal.
I dont know what is wrong? Please help.
I am exposing Master Page controls as public property and registering/calling its event on content pages.
Your expert opinion required.
Regards
|
|
|
|
|
Soulds like you are not checking IsPostBack
public void page_Load(...)
{
if(!IsPostBack)
{
Redirect...
}
}
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
My web form contains a popupextender when the popup is opened,after closing the popup the events outside the popoup like button click and dropdownselectedindex changed were not firing for the first time,second time the events are firing. Can anybody suggest me a sloution.....
|
|
|
|
|
hai,
Please make sure that you have included the
if(!IsPostBack)
{}
in the page load..
|
|
|
|
|