如何在C#中使用Quickbase API上载文件?

如何在C#中使用Quickbase API上载文件?,c#,asp.net,quickbase,C#,Asp.net,Quickbase,我正在使用从外部站点向Quickbase提交表单。我想随表格附上一个文件,但似乎不知道怎么做 以下是我的代码的精简版本: ASPX 提前谢谢。当然,我会在提交给StackOverflow后解决我自己的问题。当然 但我会发布我的解决方案,以防其他人也有同样的问题 我必须添加一个函数并重新编译DLL才能使其正常工作 将此行添加到IQRecord.cs: void UploadFile(string columnName, string filePath); public void UploadFi

我正在使用从外部站点向Quickbase提交表单。我想随表格附上一个文件,但似乎不知道怎么做

以下是我的代码的精简版本:

ASPX


提前谢谢。

当然,我会在提交给StackOverflow后解决我自己的问题。当然

但我会发布我的解决方案,以防其他人也有同样的问题

我必须添加一个函数并重新编译DLL才能使其正常工作

将此行添加到IQRecord.cs:

void UploadFile(string columnName, string filePath);
public void UploadFile(string columnName, string filePath)
{
    // create new field with columnName
    var index = GetColumnIndex(columnName);
    CreateNewField(index, columnName);

    // change field type to file
    Columns[index].ColumnType = FieldType.file;

    // Get field location with column index
    var fieldIndex = _fields.IndexOf(new QField(Columns[index].ColumnId));
    SetExistingField(index, fieldIndex, filePath);
}
将此函数添加到QRecord.cs:

void UploadFile(string columnName, string filePath);
public void UploadFile(string columnName, string filePath)
{
    // create new field with columnName
    var index = GetColumnIndex(columnName);
    CreateNewField(index, columnName);

    // change field type to file
    Columns[index].ColumnType = FieldType.file;

    // Get field location with column index
    var fieldIndex = _fields.IndexOf(new QField(Columns[index].ColumnId));
    SetExistingField(index, fieldIndex, filePath);
}
像这样编译和使用:

// code to upload file to temporary location
newRecord.UploadFile("Story", "path_to_temporary_location");
// delete temporary file

非常感谢你的这篇文章!我不需要上传文件,我只需要知道如何将新记录添加到Quickbase表,您的帖子向我展示了如何。